Submission #851770

#TimeUsernameProblemLanguageResultExecution timeMemory
851770lovrotPoi (IOI09_poi)C++17
100 / 100
258 ms20208 KiB
#include <cstdio> #include <algorithm> using namespace std; const int N = 2010; int n, m, p, B[N][N]; int SO[N], SC[N], AC[N]; int I[N]; int main() { scanf("%d%d%d", &n, &m, &p); for(int i = 0; i < n; ++i) for(int j = 0; j < m; ++j) { scanf("%d", &B[i][j]); SO[j] += B[i][j]; AC[i] += B[i][j]; } for(int i = 0; i < n; ++i) { I[i] = i; for(int j = 0; j < m; ++j) SC[i] += B[i][j] * (n - SO[j]); } sort(I, I + n, [](int a, int b) { return SC[a] > SC[b] || (SC[a] == SC[b] && AC[a] > AC[b]) || (SC[a] == SC[b] && AC[a] == AC[b] && a < b); }); printf("%d ", SC[p - 1]); for(int i = 0; i < n; ++i) if(I[i] == p - 1) printf("%d\n", i + 1); return 0; }

Compilation message (stderr)

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