제출 #289692

#제출 시각아이디문제언어결과실행 시간메모리
289692b00n0rpPoi (IOI09_poi)C++17
100 / 100
312 ms23800 KiB
#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 timeMemoryGrader output
Fetching results...