# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439263 | luka1234 | Poi (IOI09_poi) | C++14 | 758 ms | 23896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;
int task[2001];
int cont[2001][2001];
pair<int,pair<int,int> > a[2001];
bool comp(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b){
if(a.ff<b.ff)
return 1;
else{
if(a.ff==b.ff){
if(a.ss.ff<b.ss.ff)
return 1;
else{
if(a.ss.ff==b.ss.ff){
if(a.ss.ss<b.ss.ss)
return 1;
else
return 0;
}
else
return 0;
}
}
else
return 0;
}
}
int main(){
int n,m,p;
cin>>n>>m>>p;
for(int k=1;k<=n;k++){
for(int i=1;i<=m;i++){
cin>>cont[k][i];
if(cont[k][i]==0)
task[i]++;
}
}
for(int k=1;k<=n;k++){
for(int i=1;i<=m;i++){
if(cont[k][i]==1){
a[k].ff+=task[i];
a[k].ss.ff++;
}
}
a[k].ss.ss=k;
}
sort(a+1,a+n+1,comp);
for(int k=1;k<=n;k++){
if(a[k].ss.ss==p){
cout<<a[k].ff<<' '<<k;
//return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |