제출 #347928

#제출 시각아이디문제언어결과실행 시간메모리
347928AlmaPoi (IOI09_poi)C++14
0 / 100
689 ms32620 KiB
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; void POI (vector<vector<int>>& results, int& N, int& T, int& P) { vector<int> value; value.assign(T, 0); // value of each problem for (int i = 0; i < N; i++) { for (int j = 0; j < T; j++) { if (results[i][j] == 0) { value[j]++; } } } // scores: points-solved-ID vector<vector<int>> scores (N); for (int i = 0; i < N; i++) { int points = 0; int solved = 0; vector<int> scr (3); for (int j = 0; j < 3; j++) { if (results[i][j] == 1) { points += value[j]; solved++; } } scores[i][0] = points; scores[i][1] = solved; scores[i][2] = i+1; } // Philip: int P_score = scores[P-1][0]; int P_solved = scores[P-1][1]; int P_rank; // Philip rank sort(scores.rbegin(), scores.rend()); for (int i = 0; i < N; i++) { if (scores[i][0] == P_score) { if (scores[i][1] == P_solved) { if (scores[i][2] == P) { P_rank = i+1; }}} } cout << P_score << ' ' << P_rank << endl; } int main () { int N, T, P; cin >> N >> T >> P; vector<vector<int>> results; for (int i = 0; i < N; i++) { vector<int> res (T); for (int j = 0; j < T; j++) { int a; cin >> a; res[j] = a; } results.push_back(res); } POI (results, N, T, P); }

컴파일 시 표준 에러 (stderr) 메시지

poi.cpp: In function 'void POI(std::vector<std::vector<int> >&, int&, int&, int&)':
poi.cpp:48:31: warning: 'P_rank' may be used uninitialized in this function [-Wmaybe-uninitialized]
   48 |     cout << P_score << ' ' << P_rank << endl;
      |                               ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...