# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522609 | ddy888 | Poi (IOI09_poi) | C++17 | 232 ms | 17384 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;
#define ll long long
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i = a; i < b; i++)
#define db(x) cerr << "[ " << #x << ": " << x << " ]";
#define fast ios_base::sync_with_stdio(0); cin.tie(0)
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
ll n,t,p,done[2005];
vector<int> v[2005];
vector<tuple<int,int,int> > score; // score, position, solves
bool cmp(tuple<int,int,int> a, tuple<int,int,int> b) {
if (get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b);
else if (get<2>(a) != get<2>(b)) return get<2>(a) > get<2>(b);
else return get<1>(a) < get<1>(b);
}
int main() {
fast;
cin >> n >> t >> p;
rep(i,0,n) {
rep(j,0,t) {
int tp; cin >> tp;
if (tp == 1) v[i].pb(j);
done[j] += tp;
}
}
rep(i,0,n) {
ll tmp = 0;
for (auto it: v[i]) {
tmp += n - done[it];
}
score.pb(make_tuple(tmp,i,v[i].size()));
}
sort(score.begin(),score.end(),cmp);
ll cnt = 1;
for (auto it: score) {
if (get<1>(it)+1 == p) {
cout << get<0>(it) << " " << cnt;
return 0;
}
cnt++;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |