제출 #384967

#제출 시각아이디문제언어결과실행 시간메모리
384967knightron0Poi (IOI09_poi)C++14
100 / 100
301 ms39844 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fr first #define sc second #define clr(a, x) memset(a, x, sizeof(a)) #define dbg(x) cout<<"("<<#x<<"): "<<x<<endl; #define printvector(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl; #define all(v) v.begin(), v.end() #define lcm(a, b) (a * b)/__gcd(a, b) #define int long long int #define printvecpairs(vec) for(auto it: vec) cout<<it.fr<<' '<<it.sc<<endl; #define endl '\n' #define float long double const int MOD = 1e9 + 7; const int INF = 2e15; const int MAXN = 1e5 + 5; bool compare(pair<int, pair<int, int>> p1, pair<int, pair<int, int>> p2){ if(p1.fr == p2.fr){ if(p1.sc.fr == p2.sc.fr){ return p1.sc.sc < p2.sc.sc; } else { return p1.sc.fr > p2.sc.fr; } } else { return p1.fr > p2.fr; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int n, m, p; cin>>n>>m>>p; vector<vector<int>> a; int score[m+3]; clr(score, 0); for(int i = 0;i<n;i++){ vector<int> tmp; for(int j= 0;j<m;j++){ int x; cin>>x; tmp.pb(x); score[j] += (x==0); } a.pb(tmp); } vector<pair<int, pair<int, int>>> scores; for(int i= 0;i<n;i++){ pair<int, pair<int, int>> pii; pii.sc.sc = i+1; pii.sc.fr = pii.fr = 0; for(int j= 0;j<m;j++){ pii.fr += (a[i][j]*score[j]); pii.sc.fr += a[i][j]; } scores.pb(pii); } sort(all(scores), compare); for(int i = 0;i<(int)scores.size();i++){ if(scores[i].sc.sc == p){ cout<<scores[i].fr<<' '<<i+1<<endl; return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...