제출 #632241

#제출 시각아이디문제언어결과실행 시간메모리
632241devicePoi (IOI09_poi)C++17
100 / 100
617 ms18820 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second bool cmp(pair<int,pair<int,int>> a, pair<int,pair<int,int>> b){ if(a.ss.ff != b.ss.ff) return a.ss.ff > b.ss.ff; else if(a.ss.ss != b.ss.ss) return a.ss.ss > b.ss.ss; else return a.ff < b.ff; } int main(){ int n,t,p; cin >> n >> t >> p; pair<int,int> par[n+1]; vector<int> psolved[t+1]; int tsolved[t+1] = {}; for(int i = 1; i <= n; i++) par[i] = {0,0}; for(int i = 1; i <= n; i++){ for(int j = 1; j <= t; j++){ int cmd; cin >> cmd; if(cmd){ psolved[j].pb(i); tsolved[j]++; par[i].ss++; } } } for(int i = 1; i <= t; i++){ for(int nxt:psolved[i]){ par[nxt].ff += n-tsolved[i]; } } vector<pair<int,pair<int,int>>> v; for(int i = 1; i <= n; i++){ v.pb({i,par[i]}); } sort(v.begin(),v.end(),cmp); for(int i = 0; i < n; i++){ if(v[i].ff == p) cout << v[i].ss.ff << " " << i+1 << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...