26 задание

Revision ru1, by kir3.1415, 2024-11-12 17:11:17

define _CRT_SECURE_NO_WARNINGS

include

include

include

include

include

include

include

using namespace std;

int main() { freopen("26.txt","r",stdin); int n; cin>>n; vector<pair<int,int>>b; vectora,c; for(int i=0;i<n;i++){ int sum=0,x,y,t=0; cin>>x; for(int j=1;j<5;j++){ cin>>y; if(y==2)t++; sum+=y; } if(t==0){ b.push_back(make_pair(sum,x)); } else if(t==3){ a.push_back(x); } else if(t==4){ c.push_back(x); } } sort(b.begin(),b.end()); sort(a.begin(),a.end()); sort(c.begin(),c.end()); vectorb1,b2; for(int i=b.size()-1;i>0;i--){ b1.push_back(b[i].second); if(b[i].first!=b[i-1].first){ sort(b1.begin(),b1.end()); for(int j=0;j<b1.size();j++){ b2.push_back(b1[j]);

}b1.clear();
        if(i==1)b2.push_back(b[i-1].second);
    }
    else if(i==1){
        b1.push_back(b[i-1].second);
        sort(b1.begin(),b1.end());
        for(int j=0;j<b1.size();j++){
            b2.push_back(b1[j]);
        }b1.clear();
    }
}

cout<<b2[n/4-1]<<" ";
if(a.size()==0){
    cout<<c[0];
}
else cout<<a[0];
return 0;

}

//8 //4 4 4 4 4 //7 5 5 5 2 //10 3 4 4 5 //1 4 4 4 3 //6 3 5 5 3 //2 2 2 2 2 //13 2 2 2 3 //3 3 3 3 3

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian kir3.1415 2024-11-12 17:12:49 34 Мелкая правка: '#define _C' -> '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#define _C'
ru1 Russian kir3.1415 2024-11-12 17:11:17 1613 Первая редакция (опубликовано)