# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484441 | PoPularPlusPlus | Poi (IOI09_poi) | C++17 | 236 ms | 23744 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 ull unsigned long long
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}
bool cmp(pair<int,pair<int,int>> x , pair<int,pair<int,int>> y){
if(x.vf != y.vf)return x.vf > y.vf;
if(x.vs.vf != y.vs.vf)return x.vs.vf > y.vs.vf;
return x.vs.vs < y.vs.vs;
}
void solve(){
int n,t,p;
cin >> n >> t >> p;
p--;
int arr[n][t];
int c[n] , cnt[t];
memset(c,0,sizeof c);
memset(cnt,0,sizeof cnt);
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
cin >> arr[i][j];
if(arr[i][j] == 1)c[i]++,cnt[j]++;
}
}
vector<pair<int,pair<int,int>>> v;
for(int i = 0; i < n; i++){
int points = 0;
for(int j = 0; j < t; j++){
if(arr[i][j] == 1){
points += n - cnt[j];
}
}
v.pb(mp(points , mp(c[i] , i)));
}
sort(all(v) , cmp);
int a,b;
for(int i = 0; i < n; i++){
if(v[i].vs.vs == p){
a = v[i].vf;
b = i + 1;
}
}
cout << a << ' ' << b << '\n';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//int t;cin >> t;while(t--)
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |