제출 #501506

#제출 시각아이디문제언어결과실행 시간메모리
501506aryan12Poi (IOI09_poi)C++17
100 / 100
254 ms39620 KiB
#include <bits/stdc++.h> using namespace std; #define int long long mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); bool cmp(array<int, 3> a, array<int, 3> b) { if(a[0] == b[0]) { if(a[1] == b[1]) { return a[2] < b[2]; } return a[1] > b[1]; } return a[0] > b[0]; } void Solve() { int n, t, p; cin >> n >> t >> p; int a[n + 1][t + 1]; for(int i = 1; i <= n; i++) { for(int j = 1; j <= t; j++) { cin >> a[i][j]; } } int points[t + 1]; for(int j = 1; j <= t; j++) { int cnt = 0; for(int i = 1; i <= n; i++) { cnt += 1 - a[i][j]; } points[j] = cnt; } vector<array<int, 3> > ranking; for(int i = 1; i <= n; i++) { int cnt_of_points = 0, cnt_of_solves = 0; for(int j = 1; j <= t; j++) { if(a[i][j] == 1) { cnt_of_solves++; cnt_of_points += points[j]; } } ranking.push_back({cnt_of_points, cnt_of_solves, i}); } sort(ranking.begin(), ranking.end(), cmp); for(int i = 0; i < ranking.size(); i++) { if(ranking[i][2] == p) { cout << ranking[i][0] << " " << i + 1 << "\n"; return; } } assert(false); } int32_t main() { auto begin = std::chrono::high_resolution_clock::now(); ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--) { Solve(); } auto end = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin); cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; return 0; }

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

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