Submission #1119797

#TimeUsernameProblemLanguageResultExecution timeMemory
1119797kasdoPoi (IOI09_poi)C++14
100 / 100
422 ms39104 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 2005; int a[maxn][maxn], scores[maxn]; int n, t, p; struct ptt { int v, c, idx; }; bool cmp(ptt a, ptt b) { if (a.v == b.v) { if (a.c == b.c) return a.idx < b.idx; return a.c > b.c; } return a.v > b.v; } signed main() { cin>>n>>t>>p; for(int i=0; i<n; i++) { for(int j=0; j<t; j++) { cin>>a[i][j]; scores[j] += a[i][j]; } } int ans = 0, cnt = 0; vector<ptt> v; for(int i=0; i<n; i++) { int cur = 0, cur2 = 0; for(int j=0; j<t; j++) { if (a[i][j] == 1) { cur += n - scores[j]; cur2++; } } if (i == p - 1) ans = cur; v.push_back({cur, cur2, i}); } sort(v.begin(), v.end(), cmp); for(auto [i, j, idx] : v) { cnt++; if (idx == p - 1) { cout<<ans<<" "<<cnt<<endl; break; } } return 0; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:51:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   51 |     for(auto [i, j, idx] : v)
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...