Submission #252339

#TimeUsernameProblemLanguageResultExecution timeMemory
252339SamAndPoi (IOI09_poi)C++17
100 / 100
452 ms23892 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2003; struct ban { int i, q, s; ban() { i = q = s = 0; } }; bool operator<(const ban& a, const ban& b) { if (a.s > b.s) return true; if (a.s < b.s) return false; if (a.q > b.q) return true; if (a.q < b.q) return false; return a.i < b.i; } int n, m, p; int a[N][N]; int u[N]; ban b[N]; int main() { #ifdef SOMETHING freopen("input.txt", "r", stdin); #endif // SOMETHING scanf("%d%d%d", &n, &m, &p); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) scanf("%d", &a[i][j]); } for (int j = 1; j <= m; ++j) u[j] = n; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) u[j] -= a[i][j]; } for (int i = 1; i <= n; ++i) { b[i].i = i; for (int j = 1; j <= m; ++j) { b[i].q += a[i][j]; if (a[i][j]) b[i].s += u[j]; } } sort(b + 1, b + n + 1); for (int i = 1; i <= n; ++i) { if (b[i].i == p) { printf("%d %d\n", b[i].s, i); } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &p);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
poi.cpp:41:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &a[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...