제출 #717736

#제출 시각아이디문제언어결과실행 시간메모리
717736VMaksimoski008Poi (IOI09_poi)C++14
0 / 100
191 ms452 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; void setIO() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); } bool cmp(pair<int, int> a, pair<int, int> b) { if(a.second != b.second) return (a.second > b.second); else return (a.first < b.first); } int main() { setIO(); int n, t, p, x; int totalPoints = 0; cin >> n >> t >> p; vector<int> taskPoints(t+1, n); vector<int> phillipSolved; vector<pair<int, int> > rankList; for(int i=0; i<n; i++) { for(int j=0; j<t; j++) { cin >> x; if(x == 1) taskPoints[j+1] -= 1; if(i+1 == p) { if(x == 1) phillipSolved.pb(j+1); } } } for(int h : phillipSolved) totalPoints += taskPoints[h]; for(int i=1; i<=n; i++) { rankList.pb({i, 0}); for(int j=1; j<=t; j++) { rankList[rankList.size()-1].second += taskPoints[j]; } } sort(rankList.begin(), rankList.end(), cmp); int phillipRank = 0; for(auto a : rankList) { phillipRank++; if(a.first == p) break; } cout << totalPoints << " " << phillipRank << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...