Submission #221209

#TimeUsernameProblemLanguageResultExecution timeMemory
221209tatyamPoi (IOI09_poi)C++17
100 / 100
157 ms8908 KiB
#include <bits/stdc++.h>
using namespace std;
using tuplis = array<int, 3>;
#define name2(a,b,c,...) c
#define rep1(b) for(int i = 0; i < b; i++)
#define rep2(i,b) for(int i = 0; i < b; i++)
#define rep(...) name2(__VA_ARGS__,rep2,rep1)(__VA_ARGS__)
#define each(i,a) for(auto&& i : a)
#define all(a) begin(a), end(a)


int main(){
    int n, t, p;
    cin >> n >> t >> p;
    p--;
    vector<vector<bool>> a(t, vector<bool>(n));
    rep(n) rep(j, t){
        char c;
        while(~(c = getchar()) & 48);
        a[j][i] = c & 1;
    }
    vector<int> point(t);
    rep(t) point[i] = n - accumulate(all(a[i]), 0);
    vector<tuplis> b(n);
    rep(n){
        b[i][2] = i;
        rep(j, t) if(a[j][i]){
            b[i][0] -= point[j];
            b[i][1]--;
        }
    }
    sort(all(b));
    rep(n) if(b[i][2] == p) cout << -b[i][0] << ' ' << i + 1 << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...