Submission #789167

#TimeUsernameProblemLanguageResultExecution timeMemory
789167irmuunPoi (IOI09_poi)C++17
100 / 100
191 ms23788 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() bool compare(tuple<int,int,int>a,tuple<int,int,int>b){ if(get<0>(a)>get<0>(b)){ return true; } if(get<0>(a)<get<0>(b)){ return false; } if(get<1>(a)>get<1>(b)){ return true; } if(get<1>(a)<get<1>(b)){ return false; } return get<2>(a)<get<2>(b); } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,t,p; cin>>n>>t>>p; int a[n+1][t+1]; tuple<int,int,int>point[n+1]; int score[t+1]; fill(score,score+t+1,0); for(int i=1;i<=n;i++){ for(int j=1;j<=t;j++){ cin>>a[i][j]; score[j]+=(1-a[i][j]); } } for(int i=1;i<=n;i++){ get<2>(point[i])=i; for(int j=1;j<=t;j++){ if(a[i][j]==1){ get<1>(point[i])++; get<0>(point[i])+=score[j]; } } } sort(point+1,point+n+1,compare); for(int i=1;i<=n;i++){ if(get<2>(point[i])==p){ cout<<get<0>(point[i])<<' '<<i; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...