# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495538 | PiejanVDC | Poi (IOI09_poi) | C++17 | 573 ms | 888 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;
signed main() {
int n,t,p; cin>>n>>t>>p;
vector<int>v(t,n);
vector<int>cnt(n,0);
vector<vector<bool>>l(n,vector<bool>(t,0));
for(int i = 0 ; i < n ; i++) {
for(int j = 0 ; j < t ; j++) {
int x; cin>>x;
if(x) l[i][j] = 1;
if(l[i][j]) v[j]--,cnt[i]++;
}
}
vector<pair<int,int>>scores;
int sc;
for(int i = 0 ; i < n ; i++) {
int score = 0;
for(int j = 0 ; j < t ; j++) {
if(l[i][j]) score += v[j];
}
scores.push_back({score,i});
if(i == p-1) sc = score;
}
p--;
int pos = 1;
for(int i = 0 ; i < n ; i++) {
if(scores[i].second == p) continue;
if(scores[i].first > sc) pos++;
else if(scores[i].first == scores[p].first) {
if(cnt[scores[i].second] > cnt[p]) pos++;
else if(cnt[scores[i].second] == cnt[p]) {
if(scores[i].second < p) pos++;
}
}
}
cout << scores[p].first << " " << pos;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |