Submission #335585

#TimeUsernameProblemLanguageResultExecution timeMemory
335585JoshcPoi (IOI09_poi)C++11
100 / 100
494 ms23916 KiB
#include <cstdio> #include <algorithm> #include <vector> using namespace std; int l[2001][2001], v[2001]; int main() { int n, t, p; scanf("%d%d%d", &n, &t, &p); for (int i=1; i<=n; i++) { for (int j=1; j<=t; j++) scanf("%d", &l[i][j]); } for (int i=1; i<=t; i++) { for (int j=1; j<=n; j++) v[i] += !l[j][i]; } vector<pair<int, pair<int, int> > > x; for (int i=1; i<=n; i++) { int a=0, b=0; for (int j=1; j<=t; j++) { a += l[i][j]*v[j]; b += l[i][j]; } x.push_back({-a, {-b, i}}); } sort(x.begin(), x.end()); for (int i=0; i<n; i++) { if (x[i].second.second == p) printf("%d %d\n", -x[i].first, i+1); } }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d%d%d", &n, &t, &p);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
poi.cpp:12:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |         for (int j=1; j<=t; j++) scanf("%d", &l[i][j]);
      |                                  ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...