# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
739261 | Unforgettablepl | Poi (IOI09_poi) | C++17 | 268 ms | 25508 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.
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
bool compa(vector<ll> &a, vector<ll> &b){
if(a[0]==b[0]){
if(a[1]==b[1]){
return a[2]<b[2];
} else {
return a[1]>b[1];
}
} else {
return a[0]>b[0];
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("measurement.in","r",stdin);
// freopen("measurement.out","w",stdout);
ll n,t,p;
cin >> n >> t >> p;
p--;
vector<ll> marks(t,0);
vector<vector<ll>> scores(n,vector<ll>(3));
vector<vector<ll>> solved(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
int a;
cin >> a;
if(a){
solved[i].emplace_back(j);
} else {
marks[j]++;
}
}
}
for (int i = 0; i < n; i++) {
scores[i][2] = i;
scores[i][1] = solved[i].size();
scores[i][0] = 0;
for (auto &j: solved[i]) {
scores[i][0]+=marks[j];
}
}
sort(all(scores),compa);
for (int i = 0; i < n; i++) {
if(scores[i][2]==p){
cout << scores[i][0] << ' ' << i+1;
return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |