# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
929011 |
2024-02-17T13:25:24 Z |
NourWael |
Hokej (COCI17_hokej) |
C++17 |
|
269 ms |
43912 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<pair<pair<int,int>,int>> subs;
vector<pair<pair<int,int>,int>> players;
int game[7][500005];
int ind[500005], sum;
signed main() {
int n,m; cin>>m>>n;
for(int i=0; i<n; i++) {
int x,y; cin>>x>>y;
players.push_back({{x,y},i});
}
sort(players.begin(),players.end());
int now = n-1;
for(int i=0; i<6; i++) {
for(int min = 0; min<m; min++ ) {
if(players[now].first.second==0) now--;
game[i][min] = players[now].second;
sum += players[now].first.first;
players[now].first.second--;
}
}
cout<<sum<<'\n';
for(int i=0; i<6; i++) {
for(int min=1; min<m; min++) {
if(game[i][min]!=game[i][min-1]) subs.push_back({{min, game[i][min-1]+1}, game[i][min]+1});
}
}
for(int i=0; i<6; i++) cout<<game[i][0]+1<<' ';
cout<<'\n';
cout<<subs.size()<<'\n';
sort(subs.begin(),subs.end());
for(auto it:subs) cout<<it.first.first<<' '<<it.first.second<<' '<<it.second<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
4 ms |
13056 KB |
Output is correct |
3 |
Correct |
29 ms |
27860 KB |
Output is correct |
4 |
Correct |
2 ms |
12632 KB |
Output is correct |
5 |
Correct |
11 ms |
25432 KB |
Output is correct |
6 |
Correct |
3 ms |
12892 KB |
Output is correct |
7 |
Incorrect |
5 ms |
13144 KB |
Output isn't correct |
8 |
Incorrect |
44 ms |
18312 KB |
Output isn't correct |
9 |
Incorrect |
244 ms |
43912 KB |
Output isn't correct |
10 |
Incorrect |
269 ms |
43908 KB |
Output isn't correct |