# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
650744 | muazhussain | Poi (IOI09_poi) | C++17 | 230 ms | 23772 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>
using namespace std;
bool func(const pair<pair<int,int>,int>p1, const pair<pair<int,int>,int> p2){
if(p1.first.second!=p2.first.second){
return p1.first.second<p2.first.second;
}else if(p1.second!=p2.second){
return p1.second<p2.second;
}
return p1.first.first<p2.first.first;
}
void solve(){
int N,T,P;
cin>>N>>T>>P;
int ar[N][T];
vector<int>mark(T,N);
vector<int>task(N);
for(int i=0;i<N;i++){
for(int j=0;j<T;j++){
cin>>ar[i][j];
if(ar[i][j]){
mark[j]--;
task[i]++;
}
}
}
vector<pair<pair<int,int>,int>>res;
for(int i=1;i<=N;i++){
int score=0;
for(int j=0;j<T;j++){
score+=(ar[i-1][j]*mark[j]);
}
res.push_back({{i,score},task[i-1]});
}
// for(auto e:res){
// cout<<"id: "<<e.first.first<<" score: "<<e.first.second<<" task: "<<e.second<<endl;
// }
sort(res.begin(), res.end(),func);
// for(auto e:res){
// cout<<"id: "<<e.first.first<<" score: "<<e.first.second<<" task: "<<e.second<<endl;
// }
int cnt=1;
for(auto e:res){
if(e.first.first==P){
cout<<e.first.second<<" "<<cnt<<"\n";
return;
}
cnt++;
}
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int T=1;
// cin>>T;
while(T--){
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |