| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 858806 | aykhn | Poi (IOI09_poi) | C++14 | 182 ms | 39764 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>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
const int MXN = 2e3 + 5;
int freq[MXN];
int mat[MXN][MXN];
void _()
{
    int n, m, p;
    cin >> n >> m >> p;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            cin >> mat[i][j];
            freq[j] += mat[i][j];
        }
    }
    vector<pair<pii, int>> v;
    for (int i = 1; i <= n; i++)
    {
        int s = 0;
        int c = 0;
        for (int j = 1; j <= m; j++)
        {
            if (mat[i][j]) s += n - freq[j];
            c += mat[i][j];
        }
        v.pb(mpr(mpr(s, c), i));
    }
    sort(all(v), [&](const pair<pii, int> &a, pair<pii, int> &b)
    {
        if (a.fi == b.fi) return a.se < b.se;
        return a.fi > b.fi;
    });
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i].se == p)
        {
            cout << v[i].fi.fi << " " << i + 1 << '\n';
            return;
        }
    }
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++)
    {
        _();
    }
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
