# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
561882 | Halym2007 | Poi (IOI09_poi) | C++11 | 332 ms | 31872 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 ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 5005;
void solve();
int n, t, kl, c, a[N][N];
pair <int, pair <int, int>> p[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> n >> t >> kl;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= t; ++j) {
cin >> a[i][j];
}
}
for (int i = 1; i <= t; ++i) {
c = 0;
for (int j = 1; j <= n; ++j) {
if (!a[j][i]) c++;
}
for (int j = 1; j <= n; ++j) if (a[j][i]) p[j].ff += c;
}
for (int i = 1; i <= n; ++i) {
c = 0;
for (int j = 1; j <= t; ++j) {
if (a[i][j] == 1) c++;
}
p[i].ss.ff = c;
p[i].ss.ss = i;
}
for (int i = 1; i <= n; ++i) {
p[i].ff *= -1;
p[i].ss.ff *= -1;
}
sort (p + 1,p + n + 1);
for (int i = 1; i <= n; ++i) {
if (p[i].ss.ss == kl) {
return cout << abs (p[i].ff) << " " << i, 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |