Submission #655600

#TimeUsernameProblemLanguageResultExecution timeMemory
655600horiseunPoi (IOI09_poi)C++11
100 / 100
265 ms4292 KiB
#include <iostream> #include <vector> #include <tuple> #include <algorithm> using namespace std; int n, t, p; bool solved[2005][2005]; int score[2005]; vector<tuple<int, int, int>> v; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> t >> p; for (int i = 1; i <= n; i++) { for (int j = 1; j <= t; j++) { cin >> solved[i][j]; } } for (int i = 1; i <= t; i++) { for (int j = 1; j <= n; j++) { score[i] += (!solved[j][i]); } } for (int i = 1; i <= n; i++) { int temp = 0, c = 0; for (int j = 1; j <= t; j++) { temp += (solved[i][j] ? score[j] : 0); c += solved[i][j]; } v.push_back({temp, c, -i}); } sort(v.begin(), v.end(), greater<tuple<int, int, int>>()); for (int i = 0; i < v.size(); i++) { if (get<2>(v[i]) == -p) { cout << get<0>(v[i]) << " " << i + 1 << "\n"; return 0; } } }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for (int i = 0; i < v.size(); i++) {
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...