제출 #495538

#제출 시각아이디문제언어결과실행 시간메모리
495538PiejanVDCPoi (IOI09_poi)C++17
100 / 100
573 ms888 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n,t,p; cin>>n>>t>>p; vector<int>v(t,n); vector<int>cnt(n,0); vector<vector<bool>>l(n,vector<bool>(t,0)); for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < t ; j++) { int x; cin>>x; if(x) l[i][j] = 1; if(l[i][j]) v[j]--,cnt[i]++; } } vector<pair<int,int>>scores; int sc; for(int i = 0 ; i < n ; i++) { int score = 0; for(int j = 0 ; j < t ; j++) { if(l[i][j]) score += v[j]; } scores.push_back({score,i}); if(i == p-1) sc = score; } p--; int pos = 1; for(int i = 0 ; i < n ; i++) { if(scores[i].second == p) continue; if(scores[i].first > sc) pos++; else if(scores[i].first == scores[p].first) { if(cnt[scores[i].second] > cnt[p]) pos++; else if(cnt[scores[i].second] == cnt[p]) { if(scores[i].second < p) pos++; } } } cout << scores[p].first << " " << pos; }

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

poi.cpp: In function 'int main()':
poi.cpp:30:9: warning: 'sc' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         if(scores[i].first > sc) pos++;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...