Submission #597487

#TimeUsernameProblemLanguageResultExecution timeMemory
597487hailPoi (IOI09_poi)C++17
100 / 100
221 ms23912 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; bool sor_tup(tuple<int, int, int> a, tuple<int, int, int> b) { if(get<0>(a)>get<0>(b)) { return true; } else if(get<0>(a)<get<0>(b)) { return false; } else { if(get<1>(a)>get<1>(b)) return true; else if(get<1>(a)<get<1>(b)) return false; else { if(get<2>(a)<get<2>(b)) return true; else return false; } } return false; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n, t, p; cin>>n>>t>>p; vector<int> t_p(t+1); vector<vector<int>> k_solves(n+1, vector<int>(t+1, 0)); vector<tuple<int, int, int>> final_r(n); for(int i=1; i<=n; i++) { get<2>(final_r[i-1])=i; for(int j=1; j<=t; j++) { cin>>k_solves[i][j]; if(not k_solves[i][j]) t_p[j]++; else get<1>(final_r[i-1])++; } } for(int i=1; i<=n; i++) { for(int j=1; j<=t; j++) { if(k_solves[i][j]) get<0>(final_r[i-1])+=t_p[j]; } } sort(final_r.begin(), final_r.end(), sor_tup); for(int i=1; i<=n; i++) { if(get<2>(final_r[i-1])==p) { cout<<get<0>(final_r[i-1])<<" "<<i<<"\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...