U E D R , A S I H C RSS

koi_aio/권영기 (rev. 1.2)

koi_aio/권영기


#include<iostream>
#include<algorithm>
using namespace std;
struct student{
	int a;
	int b;
	int c;
};
student s[120];
int check[120];
int cc(student a, student b){
	return a.c > b.c;
}
int main(void){

	int n, i, j;
	scanf("%d", &n);
	for(i = 0; i<n; i++){
		scanf("%d %d %d", &s[i].a, &s[i].b, &s[i].c);
	}
	sort( s, s+i, cc);
	int cnt = 0, ans[5];
	for(i=0; i<n; i++){
		if(cnt == 3)break;
		if(check[s[i].a] < 2){
			ans[cnt++] = i;
			check[s[i].a]++;
		}
	}
	for(i = 0; i<3; i++){
		printf("%d %d\n", s[ans[i]].a, s[ans[i]].b);
	}

	return 0;
}



ACM_ICPC/2012스터디
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:42
Processing time 0.0445 sec