# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1209167 | | basa | Poi (IOI09_poi) | C++20 | | 101 ms | 4608 KiB |
#include "bits/stdc++.h"
#include <iomanip>
using namespace std;
#define int long long
#define ld long double
signed main()
{
cin.tie(0) -> sync_with_stdio(0);
int n, t, p;
cin >> n >> t >> p;
int w[t] = {};
char s[n][t];
array<int, 3>scrs[n];
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++) cin >> s[i][j];
int cnt = 0;
for(int c = 0; c < t; c++){
if(s[i][c] == '1'){
cnt++;
w[c]++;
}
}
scrs[i] = {0, -1 * cnt, 0};
if(i == p - 1) scrs[i][2] = 1;
}
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++) scrs[i][0] += (s[i][j] == '1' ? n - w[j] : 0);
}
sort(scrs, scrs + n);
reverse(scrs, scrs + n);
for(int i = 0; i < n; i++){
if(scrs[i][2] == 1) return cout << scrs[i][0] << ' ' << i + 1, 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |