Submission #887870

#TimeUsernameProblemLanguageResultExecution timeMemory
887870JakobZorzPoi (IOI09_poi)C++17
100 / 100
190 ms23912 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> #include<cstring> typedef long long ll; typedef unsigned long long ull; typedef long double ld; using namespace std; //const int MOD=1e9+7; //typedef pair<ll,ll>Point; //typedef pair<ll,ll>Line; //#define x first //#define y second int n,t,p; int mat[2000][2000]; int tp[2000]; struct Person{ int id,points,num_solved; }; bool cmp(Person&a,Person&b){ if(a.points!=b.points) return a.points>b.points; if(a.num_solved!=b.num_solved) return a.num_solved>b.num_solved; return a.id<b.id; } void solve(){ cin>>n>>t>>p; p--; for(int i=0;i<n;i++){ for(int j=0;j<t;j++){ cin>>mat[i][j]; if(mat[i][j]==0) tp[j]++; } } vector<Person>people(n); for(int i=0;i<n;i++){ people[i].id=i; people[i].points=0; people[i].num_solved=0; } for(int i=0;i<n;i++){ for(int j=0;j<t;j++){ if(mat[i][j]==1){ people[i].num_solved++; people[i].points+=tp[j]; } } } cout<<people[p].points<<" "; sort(people.begin(),people.end(),cmp); for(int i=0;i<n;i++){ if(people[i].id==p){ cout<<i+1<<"\n"; } } } int main(){ ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL); //freopen("bank.in","r",stdin);freopen("bank.out","w",stdout); int t=1;//cin>>t; while(t--)solve(); return 0; } /* 5 3 2 0 0 1 1 1 0 1 0 0 1 1 0 1 1 0 */
#Verdict Execution timeMemoryGrader output
Fetching results...