# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1075504 |
2024-08-26T07:09:10 Z |
Ignut |
게임 (IOI13_game) |
C++17 |
|
13000 ms |
40092 KB |
// Ignut
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
using ll = long long;
vector<vector<ll>> t;
int r, c;
void init(int R, int C) {
r = R, c = C;
t.assign(R, {});
for (int i = 0; i < R; i ++) t[i].assign(4 * C, 0);
}
void Change(int ind, int v, int l, int r, int pos, ll val) {
if (l == r) {
t[ind][v] = val;
return;
}
int mid = l + (r - l) / 2;
if (pos <= mid)
Change(ind, v * 2, l, mid, pos, val);
else
Change(ind, v * 2 + 1, mid + 1, r, pos, val);
t[ind][v] = gcd(t[ind][v * 2], t[ind][v * 2 + 1]);
}
void update(int P, int Q, ll K) {
Change(P, 1, 0, c - 1, Q, K);
}
ll Ask(int ind, int v, int l, int r, int ql, int qr) {
if (ql > r || l > qr)
return 0ll;
if (l >= ql && r <= qr)
return t[ind][v];
int mid = l + (r - l) / 2;
return gcd(Ask(ind, v * 2, l, mid, ql, qr), Ask(ind, v * 2 + 1, mid + 1, r, ql, qr));
}
ll calculate(int P, int Q, int U, int V) {
ll res = 0;
for (int ind = P; ind <= U; ind ++)
res = gcd(res, Ask(ind, 1, 0, c - 1, Q, V));
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
616 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
609 ms |
40052 KB |
Output is correct |
5 |
Correct |
410 ms |
40020 KB |
Output is correct |
6 |
Correct |
462 ms |
37488 KB |
Output is correct |
7 |
Correct |
454 ms |
37080 KB |
Output is correct |
8 |
Correct |
398 ms |
37544 KB |
Output is correct |
9 |
Correct |
464 ms |
37456 KB |
Output is correct |
10 |
Correct |
401 ms |
36892 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
700 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Execution timed out |
13041 ms |
34928 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
627 ms |
39976 KB |
Output is correct |
13 |
Correct |
396 ms |
40020 KB |
Output is correct |
14 |
Correct |
474 ms |
37456 KB |
Output is correct |
15 |
Correct |
454 ms |
37200 KB |
Output is correct |
16 |
Correct |
375 ms |
37460 KB |
Output is correct |
17 |
Correct |
446 ms |
37252 KB |
Output is correct |
18 |
Correct |
389 ms |
36692 KB |
Output is correct |
19 |
Execution timed out |
13102 ms |
34868 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
388 KB |
Output is correct |
2 |
Correct |
1 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
672 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
658 ms |
40092 KB |
Output is correct |
13 |
Correct |
427 ms |
40044 KB |
Output is correct |
14 |
Correct |
527 ms |
37396 KB |
Output is correct |
15 |
Correct |
487 ms |
37204 KB |
Output is correct |
16 |
Correct |
382 ms |
37460 KB |
Output is correct |
17 |
Correct |
493 ms |
37200 KB |
Output is correct |
18 |
Correct |
424 ms |
36956 KB |
Output is correct |
19 |
Execution timed out |
13057 ms |
34948 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |