# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591801 | ozed | Poi (IOI09_poi) | C++14 | 624 ms | 23880 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
bool compare(tuple<int,int,int> &t1,tuple<int,int,int> &t2){
if((get<0>(t1)==get<0>(t2))&&(get<1>(t1)==get<1>(t2))){return get<2>(t1)<get<2>(t2);}
return false;
}
int main(){
int n,t,p;
cin>>n>>t>>p;
vector<vi>v(n);
vi score(t);
vector<tuple<int,int,int>> ranks(n);
for(int i=0;i<n;i++){
v[i]=vi(t);
for(int j=0;j<t;j++){
cin>>v[i][j];
if(v[i][j]==0){score[j]++;}
}
}
for(int i=0;i<n;i++){
get<2>(ranks[i])=i+1;
for(int j=0;j<t;j++){
if(v[i][j]==1){
get<0>(ranks[i])+=score[j];
get<1>(ranks[i])++;
}
}
}
sort(ranks.rbegin(),ranks.rend());
sort(ranks.begin(),ranks.end(),&compare);
for(int i=0;i<n;i++){
if(get<2>(ranks[i]) == p ){
cout<<get<0>(ranks[i]) << " " << i+1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |