Submission #771912

#TimeUsernameProblemLanguageResultExecution timeMemory
771912cnasteaPoi (IOI09_poi)C++14
100 / 100
471 ms15960 KiB
#include <bits/stdc++.h> using namespace std; vector<int> r(2000), s(2000); bool f(int k, int l){ if(r[k] > r[l]) return 1; if(r[k] < r[l]) return 0; if(s[k] > s[l]) return 1; if(s[k] < s[l]) return 0; if(k > l) return 0; if(k < l) return 1; } int main() { int n, t, p; cin >> n >> t >> p; int a[n][t]; vector<int> q(t); for(int i = 0; i < n; i++){ for(int j = 0; j < t; j++){ cin >> a[i][j]; if(a[i][j] == 0) q[j]++; } } for(int i = 0; i < n; i++){ for(int j = 0; j < t; j++){ if(a[i][j] == 1){ r[i] += q[j]; s[i]++; } } } vector<int> v(n); for(int i = 0; i < n; i++) v[i] = i; sort(v.begin(), v.end(), f); int i; for(i = 0; i < n; i++){ if(v[i] == p-1) break; } cout << r[p-1] << " " << i+1; return 0; }

Compilation message (stderr)

poi.cpp: In function 'bool f(int, int)':
poi.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...