Submission #782134

# Submission time Handle Problem Language Result Execution time Memory
782134 2023-07-13T15:32:34 Z Matblube Poi (IOI09_poi) C++14
100 / 100
193 ms 39464 KB
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define dbg(x) cerr<<#x<<": "<<x<<"\n";
#define fr(i, x) for(ll i=0 ; i<x ; i++)
#define fra(x, v) for(auto x:v)
#define fra1(x,v) for(auto &x:v)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define F first
#define S second
#define inf 10000000000
#define sz(x) (ll) x.size()

const double PI=acos(-1);
const ll MOD=1e9+7, maxN=100010;

struct uwu{
    ll x ,y, z;
};

ll gcd(ll a, ll b){return (!b)?a:(gcd(b, a%b));}

ll lcm(ll a, ll b){
    if(a>b) swap(a, b);
    return a/gcd(a, b)*b;
}

ll binpow(ll a, ll b){
    ll cc=1;
    while(b){
        if(b&1) cc*=a;
        a*=a;
        b>>=1;
    }
    return cc;
}
ll binpow1(ll a, ll b){
    ll cc=1;
    while(b){
        if(b&1) cc=cc*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return cc%MOD;
}

bool comp(uwu a, uwu b){
    if(a.x==b.x && a.y==b.y) return a.z<b.z;
    if(a.x==b.x) return a.y>b.y;
    return a.x>b.x;
}

void solve(){
    ll n, m, k, aux; cin>>n>>m>>k;
    vector<ll>score(m);
    vector<uwu>rank(n);
    ll resu[n][m];
    fr(i, n){
        fr(j, m){
            cin>>aux;
            resu[i][j]=aux;
            score[j]+=(aux^1);
            rank[i].y+=aux;
        }
        rank[i].z=i+1;
    }
    fr(i, n){
        fr(j, m){
            if(resu[i][j]) rank[i].x+=score[j];
        }
    }
    sort(all(rank), comp);
    fr(i, n){
        if(rank[i].z==k){
            cout<<rank[i].x<<" ";
            cout<<i+1<<"\n"; return;
        }
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 6 ms 1492 KB Output is correct
12 Correct 10 ms 2284 KB Output is correct
13 Correct 29 ms 6120 KB Output is correct
14 Correct 42 ms 8640 KB Output is correct
15 Correct 114 ms 15048 KB Output is correct
16 Correct 80 ms 16120 KB Output is correct
17 Correct 116 ms 23728 KB Output is correct
18 Correct 131 ms 26956 KB Output is correct
19 Correct 172 ms 35560 KB Output is correct
20 Correct 193 ms 39464 KB Output is correct