Difference between r1.1 and the current
@@ -38,3 +38,5 @@
}}}
----
[ACM_ICPC/2012스터디]
#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스터디