제출 #1074805

#제출 시각아이디문제언어결과실행 시간메모리
1074805ilikeeggsPoi (IOI09_poi)C++14
100 / 100
191 ms39752 KiB
#include <bits/stdc++.h> using namespace std; #define int long long bool customSort(vector<int> l, vector<int> r){ if (l[0] != r[0]) return l[0] < r[0]; else if (l[1] != r[1]) return l[1] < r[1]; else return l[2] > r[2]; } int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,t,p; cin>>n>>t>>p; vector<vector<int>> ori(n, vector<int>(t)), fin(n, vector<int>(3)); vector<int> solves(t); for(int i=0; i<n; i++){ for(int j=0; j<t; j++){ bool x; cin>>x; // input is either 1 or 0 ori[i][j] = x; solves[j] += x; } fin[i][2] = i + 1; } for(int i=0; i<n; i++){ int solved = 0; for(int j=0; j<t; j++){ fin[i][0] += (n - solves[j]) * ori[i][j]; solved += ori[i][j]; } fin[i][1] = solved; } sort(fin.begin(), fin.end(), customSort); int r = n; for(int i=0; i<n; i++){ if(fin[i][2] == p) cout << fin[i][0] << ' ' << r << endl; r--; } }
#Verdict Execution timeMemoryGrader output
Fetching results...