# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632241 | device | Poi (IOI09_poi) | C++17 | 617 ms | 18820 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 pb push_back
#define ff first
#define ss second
bool cmp(pair<int,pair<int,int>> a, pair<int,pair<int,int>> b){
if(a.ss.ff != b.ss.ff) return a.ss.ff > b.ss.ff;
else if(a.ss.ss != b.ss.ss) return a.ss.ss > b.ss.ss;
else return a.ff < b.ff;
}
int main(){
int n,t,p; cin >> n >> t >> p;
pair<int,int> par[n+1];
vector<int> psolved[t+1];
int tsolved[t+1] = {};
for(int i = 1; i <= n; i++) par[i] = {0,0};
for(int i = 1; i <= n; i++){
for(int j = 1; j <= t; j++){
int cmd; cin >> cmd;
if(cmd){
psolved[j].pb(i);
tsolved[j]++;
par[i].ss++;
}
}
}
for(int i = 1; i <= t; i++){
for(int nxt:psolved[i]){
par[nxt].ff += n-tsolved[i];
}
}
vector<pair<int,pair<int,int>>> v;
for(int i = 1; i <= n; i++){
v.pb({i,par[i]});
}
sort(v.begin(),v.end(),cmp);
for(int i = 0; i < n; i++){
if(v[i].ff == p) cout << v[i].ss.ff << " " << i+1 << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |