Submission #531448

#TimeUsernameProblemLanguageResultExecution timeMemory
531448AdamGSPoi (IOI09_poi)C++17
100 / 100
239 ms23800 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=2e3+7;
int ile[LIM], T[LIM][LIM];
pair<pair<int,int>,int>W[LIM];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, t, p;
	cin >> n >> t >> p; --p;
	rep(i, t) ile[i]=n;
	rep(i, n) rep(j, t) {
		cin >> T[i][j];
		if(T[i][j]) --ile[j];
	}
	rep(i, n) {
		int a=0, b=0;
		rep(j, t) {
			if(T[i][j]) a+=ile[j];
			b+=T[i][j];
		}
		W[i]={{-a, -b}, i};
	}
	sort(W, W+n);
	rep(i, n) if(W[i].nd==p) {
		cout << -W[i].st.st << " " << i+1 << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...