---
# System prepended metadata

title: IOI2009 Day1-3 プロブディフ情報オリンピック (POI)
tags: [IOI]

---

---
tags: IOI
---
# IOI2009 Day1-3 プロブディフ情報オリンピック (POI)

やるだけ

## 問題

https://www.ioi-jp.org/ioi/2009/problems/day1/POI_jp.pdf
https://oj.uz/problem/view/IOI09_poi

## 実装

https://oj.uz/submission/221211

```cpp
#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(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, t, p;
    cin >> n >> t >> p;
    p--;
    vector<vector<bool>> a(t, vector<bool>(n));
    rep(n) rep(j, t){
        char c;
        cin >> c;
        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;
}
```