#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 201010
#define MAXS 20
#define INF 1000000000000000001
#define bb ' '
#define ln '\n'
#define Ln '\n'
ll X[MAX];
ll Y[MAX];
ll P[MAX];
int D[MAX];
ll L[MAX];
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int N, Q;
cin >> N >> Q;
int i, j;
for (i = 1; i <= Q; i++) cin >> P[i] >> D[i] >> L[i];
for (i = 1; i <= N; i++) X[i] = Y[i] = i;
for (i = Q; i >= 1; i--) {
if (D[i] == 1) { for (j = 1; j <= N; j++) if (X[j] <= P[i]) Y[j] -= L[i] * 2; }
else { for (j = 1; j <= N; j++) if (Y[j] > P[i]) X[j] += L[i] * 2; }
}
for (i = 1; i <= N; i++) cout << (X[i] - Y[i]) / 2ll << ln;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
8 ms |
500 KB |
Output is correct |
29 |
Correct |
8 ms |
496 KB |
Output is correct |
30 |
Correct |
7 ms |
468 KB |
Output is correct |
31 |
Correct |
6 ms |
468 KB |
Output is correct |
32 |
Correct |
7 ms |
468 KB |
Output is correct |
33 |
Correct |
8 ms |
392 KB |
Output is correct |
34 |
Correct |
7 ms |
468 KB |
Output is correct |
35 |
Correct |
8 ms |
492 KB |
Output is correct |
36 |
Correct |
7 ms |
472 KB |
Output is correct |
37 |
Correct |
8 ms |
472 KB |
Output is correct |
38 |
Correct |
9 ms |
516 KB |
Output is correct |
39 |
Correct |
7 ms |
468 KB |
Output is correct |
40 |
Correct |
8 ms |
596 KB |
Output is correct |
41 |
Correct |
8 ms |
468 KB |
Output is correct |
42 |
Correct |
7 ms |
468 KB |
Output is correct |
43 |
Correct |
8 ms |
548 KB |
Output is correct |
44 |
Correct |
8 ms |
468 KB |
Output is correct |
45 |
Correct |
8 ms |
536 KB |
Output is correct |
46 |
Correct |
8 ms |
468 KB |
Output is correct |
47 |
Correct |
8 ms |
468 KB |
Output is correct |
48 |
Correct |
7 ms |
500 KB |
Output is correct |
49 |
Correct |
7 ms |
476 KB |
Output is correct |
50 |
Correct |
7 ms |
468 KB |
Output is correct |
51 |
Correct |
8 ms |
472 KB |
Output is correct |
52 |
Correct |
8 ms |
512 KB |
Output is correct |
53 |
Correct |
7 ms |
460 KB |
Output is correct |
54 |
Correct |
7 ms |
468 KB |
Output is correct |
55 |
Correct |
7 ms |
496 KB |
Output is correct |
56 |
Correct |
7 ms |
468 KB |
Output is correct |
57 |
Correct |
7 ms |
468 KB |
Output is correct |
58 |
Correct |
7 ms |
472 KB |
Output is correct |
59 |
Correct |
7 ms |
468 KB |
Output is correct |
60 |
Correct |
8 ms |
468 KB |
Output is correct |
61 |
Correct |
7 ms |
468 KB |
Output is correct |
62 |
Correct |
7 ms |
472 KB |
Output is correct |
63 |
Correct |
7 ms |
476 KB |
Output is correct |
64 |
Correct |
8 ms |
508 KB |
Output is correct |
65 |
Correct |
7 ms |
468 KB |
Output is correct |
66 |
Correct |
7 ms |
468 KB |
Output is correct |
67 |
Correct |
8 ms |
468 KB |
Output is correct |
68 |
Correct |
8 ms |
468 KB |
Output is correct |
69 |
Correct |
7 ms |
468 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
1 ms |
340 KB |
Output is correct |
72 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
8 ms |
500 KB |
Output is correct |
29 |
Correct |
8 ms |
496 KB |
Output is correct |
30 |
Correct |
7 ms |
468 KB |
Output is correct |
31 |
Correct |
6 ms |
468 KB |
Output is correct |
32 |
Correct |
7 ms |
468 KB |
Output is correct |
33 |
Correct |
8 ms |
392 KB |
Output is correct |
34 |
Correct |
7 ms |
468 KB |
Output is correct |
35 |
Correct |
8 ms |
492 KB |
Output is correct |
36 |
Correct |
7 ms |
472 KB |
Output is correct |
37 |
Correct |
8 ms |
472 KB |
Output is correct |
38 |
Correct |
9 ms |
516 KB |
Output is correct |
39 |
Correct |
7 ms |
468 KB |
Output is correct |
40 |
Correct |
8 ms |
596 KB |
Output is correct |
41 |
Correct |
8 ms |
468 KB |
Output is correct |
42 |
Correct |
7 ms |
468 KB |
Output is correct |
43 |
Correct |
8 ms |
548 KB |
Output is correct |
44 |
Correct |
8 ms |
468 KB |
Output is correct |
45 |
Correct |
8 ms |
536 KB |
Output is correct |
46 |
Correct |
8 ms |
468 KB |
Output is correct |
47 |
Correct |
8 ms |
468 KB |
Output is correct |
48 |
Correct |
7 ms |
500 KB |
Output is correct |
49 |
Correct |
7 ms |
476 KB |
Output is correct |
50 |
Correct |
7 ms |
468 KB |
Output is correct |
51 |
Correct |
8 ms |
472 KB |
Output is correct |
52 |
Correct |
8 ms |
512 KB |
Output is correct |
53 |
Correct |
7 ms |
460 KB |
Output is correct |
54 |
Correct |
7 ms |
468 KB |
Output is correct |
55 |
Correct |
7 ms |
496 KB |
Output is correct |
56 |
Correct |
7 ms |
468 KB |
Output is correct |
57 |
Correct |
7 ms |
468 KB |
Output is correct |
58 |
Correct |
7 ms |
472 KB |
Output is correct |
59 |
Correct |
7 ms |
468 KB |
Output is correct |
60 |
Correct |
8 ms |
468 KB |
Output is correct |
61 |
Correct |
7 ms |
468 KB |
Output is correct |
62 |
Correct |
7 ms |
472 KB |
Output is correct |
63 |
Correct |
7 ms |
476 KB |
Output is correct |
64 |
Correct |
8 ms |
508 KB |
Output is correct |
65 |
Correct |
7 ms |
468 KB |
Output is correct |
66 |
Correct |
7 ms |
468 KB |
Output is correct |
67 |
Correct |
8 ms |
468 KB |
Output is correct |
68 |
Correct |
8 ms |
468 KB |
Output is correct |
69 |
Correct |
7 ms |
468 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
1 ms |
340 KB |
Output is correct |
72 |
Correct |
1 ms |
340 KB |
Output is correct |
73 |
Execution timed out |
2062 ms |
9408 KB |
Time limit exceeded |
74 |
Halted |
0 ms |
0 KB |
- |