# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753751 | vjudge1 | Poi (IOI09_poi) | C++17 | 200 ms | 8116 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;
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
bool comparator(pair<int, pair<int, int>>& a, pair<int, pair<int, int>>& b) {
if(a.se.se != b.se.se) return a.se.se > b.se.se;
else return a.fi < b.fi;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, t, p;
cin >> n >> t >> p;
vector <pair<int, pair<int, int>>> data(t); // id (skor, sum)
for(auto element : data) {
element.se.se = 0;
}
for(int i=0; i<t; i++) {
data[i].fi = i;
}
for(int i=0; i<n; i++) {
for(int j=0; j<t; j++) {
cin >> data[j].se.fi;
data[j].se.se += data[j].se.fi;
}
}
sort(data.begin(), data.end(), comparator);
int rank, score;
for(int i=0; i<t; i++) {
if(data[i].fi+1 == p) {
score = data[i].se.se;
rank = i+1;
break;
}
}
cout << score << " " << rank;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |