Submission #1042738

#TimeUsernameProblemLanguageResultExecution timeMemory
1042738ByeWorldPoi (IOI09_poi)C++14
100 / 100
309 ms39840 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define bupol __builtin_popcount
#define int long long
#define ll long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
const int MAXN = 2e3+15;
const int MAXA = 250100;
const int MAXK = 1e5+10;
const int INF = 4e18+10;
const int MOD = 1e9+7;
void chmn(int &a, int b){ a = min(a, b); }
void chsum(int &a, int b){ a = (a+b)%MOD; }
int mul(int a, int b){ return (a*b)%MOD; }
int sum(int a, int b){ return (a+b)%MOD; }
int expo(int a, int b){
    if(b==0) return 1;
    int te = expo(a, b/2); te = mul(te, te);
    return (b%2 ? mul(te, a) : te);
}
int n, t, p;
int a[MAXN][MAXN], cnt[MAXN], sc[MAXN], num[MAXN];

signed main(){
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> t >> p;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=t; j++){
            cin >> a[i][j];
            if(a[i][j]==0) cnt[j]++;
        }
    }
    vector <ipii> vec;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=t; j++){
            if(a[i][j]){ sc[i] += cnt[j]; num[i]++; }
        }
        vec.pb({{sc[i], num[i]}, -i});
    }
    sort(vec.rbegin(), vec.rend());
    int te = 0;
    for(auto [x, y] : vec){
        te++;
        if(-y == p){
            cout << sc[p] << ' ' << te << '\n'; exit(0);
        }
    }
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:50:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   50 |     for(auto [x, y] : vec){
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...