# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753772 | vjudge1 | Poi (IOI09_poi) | C++98 | 547 ms | 16928 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;
bool comparator(pair <pair<int, int>, int> a, pair <pair<int, int>, int> b){
if(a.first.first>b.first.first) return true;
if(a.first.first==b.first.first&&a.second>b.second) return true;
if(a.first.first==b.first.first&&a.first.second<b.first.second) return true;
return false;
}
int main(){
int n, t, p;
cin >> n >> t >> p;
int task[t+2];
vector <pair <int, int>> rank;
for(int i=0; i<n; i++){
for (int j = 1; j <= t; ++j){
int x;
cin >> x;
if(x==0) task[j]++;
if(x==1) rank.push_back(make_pair(j, i));
}
}
vector <pair <pair <int, int>, int>> final(n+2);
for (int i = 0; i < rank.size(); ++i){
final[rank[i].second].first.first+=task[rank[i].first];
final[rank[i].second].first.second=rank[i].second;
final[rank[i].second].second++;
}
sort(final.rbegin(), final.rend(), comparator);
for (int i = 0; i < n; ++i){
if(final[i].first.second==p-1){
cout << final[i].first.first << " " << i+1 << endl;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |