# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522418 | nurlitadf | Poi (IOI09_poi) | C++17 | 562 ms | 23680 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>
#define ll long long
using namespace std;
ll modexp(ll b, ll e, ll m){
ll r = 1;
while(e > 0){
if((e & 1) == 1){
r = (r * b) % m;
}
e >>= 1;
b = (b * b) % m;
}
return r;
}
bool isvowel(char ch) {
return (ch == 'a') || (ch == 'e') ||(ch == 'i') ||(ch == 'o') ||(ch == 'u') ||(ch == 'y');
}
typedef struct {
int score, cnt, id;
} result;
bool cmp(result a, result b) {
if(a.score > b.score)
return true;
if(a.score < b.score)
return false;
if(a.cnt > b.cnt)
return true;
if(a.cnt < b.cnt)
return false;
if(a.id < b.id)
return true;
return false;
}
int main() {
int n, t, p;
cin >> n >> t >> p;
p--;
vector<vector<int> > status(n);
vector<int> score(t, 0);
for(int i = 0; i < n; i++) {
for(int j = 0; j < t; j++) {
int v;
cin >> v;
status[i].push_back(v);
if(!v)
score[j]++;
}
}
vector<result> scores;
for(int i = 0; i < n; i++) {
int sum = 0;
int cnt = 0;
for(int j = 0; j < t; j++) {
if(status[i][j]) {
sum += score[j];
cnt++;
}
}
scores.push_back({sum, cnt, i});
}
sort(scores.begin(), scores.end(), cmp);
for(int i = 0; i < scores.size(); i++) {
if(scores[i].id == p) {
cout << scores[i].score << " " << i + 1 << endl;
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |