Submission #477114

#TimeUsernameProblemLanguageResultExecution timeMemory
477114glomePoi (IOI09_poi)C++17
100 / 100
320 ms23860 KiB
#include<bits/stdc++.h> using namespace std; struct S { int points = 0; int tasks = 0; int ID; }; bool cmp(S A, S B) { if(A.points != B.points) { return A.points > B.points; } if(A.tasks != B.tasks) { return A.tasks > B.tasks; } return A.ID < B.ID; } int main() { ios::sync_with_stdio(false); cin.tie(0); int N, T, P; cin >> N >> T >> P; P--; vector<vector<int>> y(N, vector<int> (T)); vector<S> ans(N); for (int i = 0; i<N; i++) { for (int j = 0; j<T; j++) { cin >> y[i][j]; } } vector<int> scores(T); for (int i = 0; i<T; i++) { int score = 0; for (int j = 0; j<N; j++) { score += y[j][i]; } scores[i] = (N - score); } for (int i = 0; i<T; i++) { for (int j = 0; j<N; j++) { if(y[j][i] == 1) { ans[j].tasks++; ans[j].ID = j; ans[j].points += scores[i]; } } } sort(ans.begin(), ans.end(), cmp); for (int i = 0; i<ans.size(); i++) { if(ans[i].ID == P) { cout << ans[i].points << ' ' << i + 1 << '\n'; return 0; } } return 0; }

Compilation message (stderr)

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