# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
991041 | SoSmolSten | Poi (IOI09_poi) | C++17 | 163 ms | 4448 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;
const int N = 2e3 + 10;
ll score[N];
bool f[N][N];
int solved[N];
int main (int argc, char const *argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, t, p; cin >> n >> t >> p;
for(int i = 1; i <= t; ++i) score[i] = n;
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= t; ++j){
cin >> f[i][j];
solved[i] += f[i][j];
score[j] -= f[i][j];
}
}
vector<pair<ll, int>> scoreboard;
for(int i = 1; i <= n; ++i){
ll sum = 0;
for(int j = 1; j <= t; ++j){
sum += f[i][j] * score[j];
}
scoreboard.push_back({sum, i});
}
sort(scoreboard.begin(), scoreboard.end(), [](pair<ll, int> a, pair<ll, int> b){
if(a.first == b.first) {
if(solved[a.second] == solved[b.second]) return a.second < b.second;
return solved[a.second] > solved[b.second];
}
return a.first > b.first;
});
for(int i = 0; i < n; ++i){
if(scoreboard[i].second == p){
cout << scoreboard[i].first << ' ' << i + 1;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |