# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104253 | melody_rules | Poi (IOI09_poi) | C++17 | 423 ms | 39548 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 int long long
using namespace std;
bool SortPair(const pair<int, pair<int, int>>& a, const pair<int, pair<int, int>>& b) {
if(a.first != b.first)
return a.first > b.first;
if(a.second.first != b.second.first)
return a.second.first > b.second.first;
return a.second.second < b.second.second;
}
signed main() {
int n=0;
int t=0;
int p=0;
int a=0;
int b=0;
int i=0;
int j=0;
cin>>n>>t>>p;
vector<vector<int>> vec(n, vector<int>(t));
vector<pair<int, pair<int, int>>> veco(n);
vector<int> vecoo(t);
for(i=0;i<n;i++) {
for(j=0;j<t;j++) {
cin>>a;
vec.at(i).at(j) = a;
}
}
for(i=0;i<t;i++) {
a=0;
for(j=0;j<n;j++) {
if(vec.at(j).at(i) == 0)
a++;
}
vecoo.at(i) = a;
}
for(i=0;i<n;i++) {
a=0;
b=0;
for(j=0;j<t;j++) {
a += (vec.at(i).at(j) * vecoo.at(j));
b += vec.at(i).at(j);
}
veco.at(i) = {a, {b, i+1}};
}
sort(veco.begin(), veco.end(), SortPair);
for(i=0;i<n;i++) {
if(veco.at(i).second.second == p) {
cout<<veco.at(i).first<<" "<<i+1<<endl;
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |