Submission #99379

# Submission time Handle Problem Language Result Execution time Memory
99379 2019-03-03T10:10:36 Z Ort Hokej (COCI17_hokej) C++11
0 / 120
186 ms 17740 KB
#include<iostream>
#include<algorithm>
#include<vector>
#define MAX 10000
#define ll long long

using namespace std;

bool cmp(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b) {
	if(a.first.first==b.first.first) return a.second < b.second;
	else return a.first.first>b.first.first;
}

int m, n, strength, endurance, id, t, _time, time_passed, block, sub;
ll total;
vector<pair<pair<int,int>, int> > players;
vector<int> starters;
vector<pair<int,int> > sol[MAX];

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	cin >> m >> n; _time = m;
	for(int i=1;i<=n;i++) {
		cin >> strength >> endurance;
		players.push_back({{strength,endurance},i});
	}
	sort(players.begin(),players.end(),cmp);
	while(t<n && block<6) {
		strength = players[t].first.first;
		endurance = players[t].first.second;
		id = players[t].second;
		if(endurance==0) {
			t++;
			continue;
		}
		_time = min(endurance, m-time_passed);
		if(time_passed==0 && starters.size()<6) {
			starters.push_back(id);
		}
		else if(t-1>0) {
			sub++;
			sol[time_passed].push_back({players[t-1].second,id});
		}
		time_passed += _time;
		total += (ll)_time*strength;
		players[t].first.second -= _time;
		if(time_passed==m) {
			block++;
			time_passed = 0;
		}
	}
	cout << total << "\n";
	for(int i=0;i<6;i++) cout << starters[i] << " ";
	cout << "\n" << sub << "\n";
	for(int i=0;i<m;i++) {
		for(int j=sol[i].size()-1;j>=0;j--) {
			cout << i << " " << sol[i][j].first << " " << sol[i][j].second;
			cout << "\n";
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Output isn't correct
2 Incorrect 5 ms 896 KB Output isn't correct
3 Runtime error 18 ms 2172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Incorrect 2 ms 512 KB Output isn't correct
5 Runtime error 8 ms 1600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Incorrect 3 ms 640 KB Output isn't correct
7 Incorrect 6 ms 896 KB Output isn't correct
8 Runtime error 39 ms 4548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 186 ms 17668 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 170 ms 17740 KB Execution killed with signal 11 (could be triggered by violating memory limits)