# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236894 |
2020-06-03T17:31:20 Z |
DanShaders |
Hokej (COCI17_hokej) |
C++17 |
|
173 ms |
10808 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define all(x) begin(x), end(x)
#define x first
#define y second
typedef long long ll;
typedef long double ld;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T>
using normal_queue = priority_queue<T, vector<T>, greater<T>>;
const int MAX_N = 5e5 + 10;
vector<pair<int, pair<int, int>>> ans;
int endAt[6];
int current[6];
int id[6];
pair<int, pair<int, int>> players[MAX_N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int m, n;
cin >> m >> n;
for (int i = 0; i < n; ++i)
cin >> players[i].x >> players[i].y.x, players[i].y.y = i;
sort(all(players));
reverse(all(players));
int ptr = 0;
int64_t res = 0;
for (int i = 0; i < m; ++i) {
for (int j = 0; j < 6; ++j) {
if (endAt[j] != i)
continue;
assert(ptr != n);
endAt[j] = players[ptr].y.x + i;
ans.push_back({i, {id[j] + 1, players[ptr].y.y + 1}});
current[j] = players[ptr].x;
id[j] = players[ptr].y.y;
++ptr;
}
res += accumulate(current, current + 6, 0ll);
}
cout << res << "\n";
int last = 1;
for (auto p : ans) {
if (p.x == 0) {
cout << p.y.y << " ";
continue;
}
if (last) {
cout << "\n" << ans.size() - 6 << "\n";
}
cout << p.x << " " << p.y.x << " " << p.y.y << "\n";
last = 0;
}
if (last)
cout << "\n0";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
6272 KB |
Output is correct |
2 |
Correct |
28 ms |
6272 KB |
Output is correct |
3 |
Correct |
40 ms |
6528 KB |
Output is correct |
4 |
Incorrect |
26 ms |
6272 KB |
Output isn't correct |
5 |
Correct |
30 ms |
6408 KB |
Output is correct |
6 |
Incorrect |
28 ms |
6272 KB |
Output isn't correct |
7 |
Incorrect |
28 ms |
6272 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
7288 KB |
Output isn't correct |
9 |
Incorrect |
173 ms |
10616 KB |
Output isn't correct |
10 |
Incorrect |
169 ms |
10808 KB |
Output isn't correct |