# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972650 | marinaluca | Poi (IOI09_poi) | C++17 | 196 ms | 39768 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>
#pragma GCC opitmize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")
using namespace std;
#define int long long
#define ll long long
#define xx first
#define yy second
#define all (x) begin (x), end(x)
int n, t, p;
const int NMAX = 2e3 + 10;
int solve[NMAX][NMAX];
int puncte[NMAX];
struct elem {
int idx = 0;
int sc = 0;
int ca = 0;
friend bool operator<(elem a, elem b){
if (a.sc == b.sc){
if (a.ca == b.ca){
return a.idx > b.idx;
}
return a.ca < b.ca;
}
return a.sc < b.sc;
}
}v[NMAX];
signed main (void){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> t >> p;
for (int i = 1; i <= n; ++ i){
v[i].idx = i;
for (int j = 1; j <= t; ++ j){
cin >> solve[i][j];
if (solve[i][j]){
v[i].ca ++, puncte[j] ++;
}
}
}
for (int j = 1; j <= t; ++ j){
puncte[j] = n - puncte[j];
}
for (int i = 1; i <= n; ++ i){
for (int j = 1; j <= t; ++ j){
if (solve[i][j]){
v[i].sc += puncte[j];
}
}
}
sort (v + 1, v + n +1);
reverse (v + 1, v + n +1);
for (int i = 1; i <= n; ++ i){
if (v[i].idx == p){
cout << v[i].sc << " " << i << '\n';
break;
}
}
return 0 ^ 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |