# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696553 | Hacv16 | Poi (IOI09_poi) | C++17 | 221 ms | 57280 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;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
int n, t, p, value[MAX], score[MAX];
vector<int> solve[MAX];
bool cmp(int a, int b){
if(score[a] != score[b]) return score[a] > score[b];
if(solve[a].size() != solve[b].size()) return solve[a].size() > solve[b].size();
return a < b;
}
int32_t main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> t >> p;
for(int i = 1; i <= t; i++) value[i] = n;
for(int i = 1; i <= n; i++){
for(int k = 1; k <= t; k++){
ll x; cin >> x;
if(x){ value[k]--; solve[i].push_back(k); }
}
}
for(int i = 1; i <= n; i++)
for(auto x : solve[i])
score[i] += value[x];
vector<int> rank(n);
iota(rank.begin(), rank.end(), 1);
sort(rank.begin(), rank.end(), cmp);
for(int i = 0; i < rank.size(); i++)
if(rank[i] == p){ cout << score[p] << ' ' << i + 1 << '\n'; exit(0); }
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |