Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- codEcsTAsy
- SUST SWE-19
- */
- #include <bits/stdc++.h>
- #define ll long long
- #define s second
- #define f first
- #define fora(i,n) for(int i=0 ; i<n ; i++)
- #define ford(i,n) for(int i=n-1 ; i>=0 ; i--)
- #define pb push_back
- using namespace std;
- typedef struct {
- int penalty=0,sol_num=0,sl;
- bool prb[101],entered=false;
- }contestant;
- bool comp(contestant a,contestant b) {
- if(a.sol_num==b.sol_num) {
- if(a.penalty==b.penalty) {
- return a.sl<b.sl;
- }
- return a.penalty<b.penalty;
- }
- return a.sol_num>b.sol_num;
- }
- int main()
- {
- ll t;
- t = 1;
- std::cin >> t;
- while( t-- ) {
- contestant cntst[101];
- for(int i=0 ; i<=100 ; i++) {
- cntst[i].sl=i;
- for(int j=1 ; j<=10 ; j++) {
- cntst[i].prb[j]=false;
- }
- }
- int a,b,c;
- char d;
- //int jhinku=5;
- while(1) {
- cin >> a >> b >> c; //contestant - problem - time - status
- cin >> d;
- //cout << a << b << c << d;
- //cntst[a].sl=a;
- cntst[a].entered=true;
- if(d=='I' && cntst[a].prb[b]!=true) {
- cntst[a].penalty+=20;
- }
- else if(d=='C' && cntst[a].prb[b]!=true) {
- cntst[a].penalty+=c;
- cntst[a].sol_num++;
- cntst[a].prb[b]=true;
- }
- }
- //vector <contestant> :: iterator it;
- //for(it=cntst.begin() ; it!=cntst.begin() ; it++) //cout << cntst[it].sl << " " << cntst[it].sol_num << " " << cntst[it].penalty << endl;cout << (*it)->sl << " " << (*it)->sol_num << " " << (*it)->penalty << endl;
- sort(cntst,cntst+101,comp);
- for(int i=0 ; i<=100 ; i++) {
- if(cntst[i].entered) {
- cout << cntst[i].sl << " " << cntst[i].sol_num << " " << cntst[i].penalty << endl;
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement