Submission #412788

#TimeUsernameProblemLanguageResultExecution timeMemory
412788rqiPoi (IOI09_poi)C++14
100 / 100
418 ms12104 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pi; #define mp make_pair #define f first #define s second #define pb push_back #define all(x) begin(x), end(x) #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int mx = 2005; bool solved[mx][mx]; int prob_val[mx]; int score[mx]; int num_solved[mx]; int main(){ cin.tie(0)->sync_with_stdio(0); int N, T, P; cin >> N >> T >> P; for(int i = 1; i <= N; i++){ for(int j = 1; j <= T; j++){ cin >> solved[i][j]; } } for(int j = 1; j <= T; j++){ for(int i = 1; i <= N; i++){ if(!solved[i][j]){ prob_val[j]++; } } } for(int i = 1; i <= N; i++){ for(int j = 1; j <= T; j++){ if(solved[i][j]){ score[i]+=prob_val[j]; num_solved[i]++; } } } // for(int j = 1; j <= T; j++){ // cout << "j, prob_val[j]: " << j << " " << prob_val[j] << "\n"; // } // for(int i = 1; i <= N; i++){ // cout<< "i, score[i]: " << i << " " << score[i] << "\n"; // } // for(int i = 1; i <= N; i++){ // cout<< "i, num_solved[i]: " << i << " " << num_solved[i] << "\n"; // } vector<pair<pi, int>> v; for(int i = 1; i <= N; i++){ v.pb(mp(mp(-score[i], -num_solved[i]), i)); } sort(all(v)); for(int i = 0; i < N; i++){ int ind = v[i].s; if(ind == P){ cout << score[ind] << " " << i+1 << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...