Submission #870210

#TimeUsernameProblemLanguageResultExecution timeMemory
870210inawahPoi (IOI09_poi)C++14
100 / 100
497 ms11972 KiB
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define MAXN 2005 int p[MAXN], s[MAXN], t[MAXN], a[MAXN]; bool m[MAXN][MAXN]; bool cmp(int const &i, int const &j) { if (s[i] != s[j]) { return s[i] > s[j]; } if (t[i] != t[j]) { return t[i] > t[j]; } return i < j; } int main() { int N, T, P; scanf("%d %d %d\n", &N, &T, &P); for (int i = 1; i <= N; ++i) { for (int j = 1; j <= T; ++j) { cin >> m[i][j]; p[j] += m[i][j]; t[i] += m[i][j]; } } for (int i = 1; i <= N; ++i) { for (int j = 1; j <= T; ++j) { s[i] += m[i][j] ? N - p[j] : 0; } } for (int i = 1; i <= N; ++i) { a[i] = i; } sort(a + 1, a + N + 1, &cmp); for (int i = 1; i <= N; ++i) { if (a[i] == P) { printf("%d %d\n", s[P], i); } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d %d %d\n", &N, &T, &P);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...