Submission #221798

#TimeUsernameProblemLanguageResultExecution timeMemory
221798patrikpavic2Poi (IOI09_poi)C++17
100 / 100
417 ms31864 KiB
/** * user: ppavic * fname: Patrik * lname: Pavić * task: poi * score: 100.0 * date: 2019-05-11 07:47:44.386747 */ #include <cstdio> #include <vector> #include <algorithm> #define X first #define Y second #define PB push_back using namespace std; typedef pair < int, int > pii; typedef pair < int , pii > pip; const int N = 3050; int n, t, p, sc[N], A[N][N]; vector < pip > v; int main(){ scanf("%d%d%d", &n, &t, &p); for(int i = 0;i < n;i++){ for(int j = 0;j < t;j++){ scanf("%d", &A[i][j]); sc[j] += !A[i][j]; } } for(int i = 0;i < n;i++){ int cur = 0, cnt = 0; for(int j = 0;j < t;j++) cur += A[i][j] * sc[j], cnt += A[i][j]; v.PB({-cur, {-cnt, i + 1}}); if(i + 1 == p) printf("%d ", cur); } sort(v.begin(), v.end()); for(int i = 0;i < n;i++){ if(v[i].Y.Y == p) printf("%d\n", i + 1); } }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &t, &p);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
poi.cpp:31: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...