Submission #561882

#TimeUsernameProblemLanguageResultExecution timeMemory
561882Halym2007Poi (IOI09_poi)C++11
100 / 100
332 ms31872 KiB
#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 timeMemoryGrader output
Fetching results...