# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218114 | kimbj0709 | Poi (IOI09_poi) | C++17 | 841 ms | 17536 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;
vector<int> arr[2000];
bool comp(pair<int,int> a,pair<int,int> b){
if(a.first != b.first){
return a.first>b.first;
}
else if(a.first==b.first&&arr[a.second].size()!=arr[b.second].size()){
return arr[a.second].size()>arr[b.second].size();
}
else{
return a.second < b.second;
}
}
int main() {
int no_of_input,no_of_tasks,pos;
int input;
vector<int> tasks;
vector<pair<int,int> > vect1;
cin >> no_of_input >> no_of_tasks >> pos;
for(int i=0;i<no_of_tasks;i++){
tasks.push_back(0);
}
for(int i=0;i<no_of_input;i++){
for(int j=0;j<no_of_tasks;j++){
cin >> input;
if(input==1){
arr[i].push_back(j);
}
else{
tasks[j]++;
}
}
}
for(int i=0;i<no_of_input;i++){
int count = 0;
for(int j=0;j<arr[i].size();j++){
count += tasks[arr[i][j]];
}
vect1.push_back(make_pair(count,i));
count = 0;
}
sort(vect1.begin(),vect1.end(),comp);
for(int i=0;i<vect1.size();i++){
if(vect1[i].second == pos-1){
cout << vect1[i].first << " " << i+1;
return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |