Submission #289692

# Submission time Handle Problem Language Result Execution time Memory
289692 2020-09-02T22:51:19 Z b00n0rp Poi (IOI09_poi) C++17
100 / 100
312 ms 23800 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
#define pb push_back
#define INF 100000000
#define mp make_pair

int main() {
	
	ios::sync_with_stdio(false);
	int n,t,p;
	cin >> n >> t >> p;
	int a[n+1][t+1],td[n+1],tv[t+1],pnt[n+1];
	//td - tasks_done, tv - tasks_value, pnt - points
	fill(td,td+n+1,0);
	fill(tv,tv+t+1,0);
	fill(pnt,pnt+n+1,0);
	for (int i = 1; i <= n; i++){
	    for (int j = 1; j <= t; j++){
	        cin >> a[i][j];
	        if (a[i][j]){
	            td[i] ++;
	        }
	        else{
	            tv[j] ++;
	        }
	    }
	}
	for (int i = 1; i <= n; i++){
	    for (int j = 1; j <= t; j++){
	        if (a[i][j]){
	            pnt[i] += tv[j];
	        }
	    }
	}
	int phil = pnt[p],rank = 1,tdp = td[p];
	cout << phil << " ";
	for (int i = 1; i <= n; i++){
	    if (i == p) continue;
	    else if (pnt[i] < phil) continue;
	    else if (pnt[i] > phil) rank ++;
	    else{
	        if (td[i] < tdp) continue;
	        else if (td[i] > tdp) rank ++;
	        else{
	            if (i < p) rank ++;
	        }
	    }
	}
	cout << rank << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 10 ms 1024 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 47 ms 3836 KB Output is correct
14 Correct 66 ms 5368 KB Output is correct
15 Correct 121 ms 9208 KB Output is correct
16 Correct 132 ms 9980 KB Output is correct
17 Correct 192 ms 14384 KB Output is correct
18 Correct 217 ms 16508 KB Output is correct
19 Correct 281 ms 21496 KB Output is correct
20 Correct 312 ms 23800 KB Output is correct