# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601189 | SlyGaleeb | Poi (IOI09_poi) | C++17 | 255 ms | 24264 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;
typedef long long ll;
#define ld long double
#define F first
#define S second
const ll N = 2e5 + 5;
vector<int>v[2005];
bool cmp (const pair<pair<int,int>,int>&a, const pair<pair<int,int>,int>&b) {
if (a.F==b.F)
return a.S<b.S;
if (a.F.F==b.F.F)
return a.F.S>b.F.S;
return a.F.F>b.F.F;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,t,p;
cin >> n >> t >> p;
vector<int>mark(t,0);
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < t; ++j) {
int a;
cin >> a;
v[i].push_back(a);
}
}
for (int j = 0; j < t; ++j) {
int cnt = 0;
for (int i = 1; i <= n; ++i) {
if (v[i][j]==0)
cnt++;
}
mark[j] = cnt;
}
vector<pair<pair<int,int>,int>>standing;
for (int i = 1; i <= n; ++i) {
int score=0, solved = 0;
for (int j = 0; j < t; ++j) {
if (v[i][j]==1) {
solved++;
score+=mark[j];
}
}
standing.push_back({{score,solved},i});
}
sort(standing.begin(),standing.end(),cmp);
for (int i = 0; i < n; ++i) {
if (standing[i].S==p) {
cout << standing[i].F.F << " " << i+1;
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |