답안 #307591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
307591 2020-09-28T18:52:47 Z sofapuden Poi (IOI09_poi) C++14
60 / 100
1061 ms 38940 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


bool comp(pair<pair<ll,ll>,ll> a, pair<pair<ll,ll>,ll> b){
	if(a.first.first == b.first.first){
		if(a.first.second == b.first.second){
			return a.second < b.second;
		}
		return a.first.second > b.first.second;
	}
	return a.first.first > b.first.first;
}

int main(){
	ll n, t, p; cin >> n >> t >> p;
	vector<ll> points(n,0);
	vector<vector<ll>> ans(n, vector<ll> (t));
	for(auto &x : ans)for(auto &y : x)cin >> y;
	for(ll i = 0; i < n; ++i){
		for(ll j = 0; j < t; ++j){
			points[j]+=!ans[i][j];
		}
	}
	vector<pair<pair<ll,ll>,ll>> order;
	for(ll i = 0; i < n; ++i){
		ll cn = 0;
		ll po = 0;
		for(ll j = 0; j < t; ++j){
			cn+=ans[i][j];
			po+=ans[i][j]*points[j];
		}
		order.push_back({{po,cn},i});
	}
	sort(order.begin(),order.end(), comp);
	for(ll i = 0; i < n; ++i){
		if(order[i].second == p-1){
			cout << order[i].first.first << " " << i+1 << "\n";
			return 0;
		}
	}
}
		
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Correct 1 ms 256 KB Output is correct
5 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Correct 1 ms 384 KB Output is correct
7 Runtime error 5 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Correct 2 ms 384 KB Output is correct
9 Runtime error 7 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Correct 9 ms 640 KB Output is correct
11 Runtime error 36 ms 2556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 54 ms 1952 KB Output is correct
13 Runtime error 167 ms 10232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Correct 229 ms 7160 KB Output is correct
15 Runtime error 413 ms 24440 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Correct 434 ms 13176 KB Output is correct
17 Runtime error 667 ms 38940 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Correct 722 ms 21752 KB Output is correct
19 Correct 955 ms 28664 KB Output is correct
20 Correct 1061 ms 31864 KB Output is correct