# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090300 |
2024-09-18T08:01:02 Z |
vjudge1 |
Game (IOI13_game) |
C++17 |
|
13000 ms |
40204 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct SegTree {
int n;
vector<ll> tree;
void init(int _n) { n = _n; tree.resize(4*_n); }
void update(int u, int tl, int tr, int p, ll v) {
if(tl == tr) {
tree[u] = v;
} else {
int tm = (tl + tr) / 2;
if(p <= tm) update(2*u, tl, tm, p, v);
else update(2*u+1, tm+1, tr, p, v);
tree[u] = gcd(tree[2*u], tree[2*u+1]);
}
}
ll query(int u, int tl, int tr, int l, int r) {
if(l > tr || tl > r) return 0;
if(l <= tl && tr <= r) return tree[u];
int tm = (tl + tr) / 2;
return gcd(query(2*u, tl, tm, l, r), query(2*u+1, tm+1, tr, l, r));
}
void update(int p, ll v) { update(1, 0, n-1, p, v); }
ll query(int l, int r) { return query(1, 0, n-1, l, r); }
};
vector<SegTree> tree;
void init(int R, int C) {
tree.resize(R);
for(int i=0; i<R; i++) tree[i].init(C);
}
void update(int P, int Q, ll K) {
tree[P].update(Q, K);
}
ll calculate(int P, int Q, int U, int V) {
ll ans = 0;
for(int i=P; i<=U; i++) ans = gcd(ans, tree[i].query(Q, V));
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
692 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
616 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 |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
538 ms |
40048 KB |
Output is correct |
5 |
Correct |
369 ms |
40020 KB |
Output is correct |
6 |
Correct |
427 ms |
37264 KB |
Output is correct |
7 |
Correct |
414 ms |
37208 KB |
Output is correct |
8 |
Correct |
330 ms |
37460 KB |
Output is correct |
9 |
Correct |
377 ms |
37284 KB |
Output is correct |
10 |
Correct |
365 ms |
36940 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
1 ms |
600 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 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 |
0 ms |
604 KB |
Output is correct |
12 |
Execution timed out |
13049 ms |
36216 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
600 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
511 ms |
40052 KB |
Output is correct |
13 |
Correct |
354 ms |
40016 KB |
Output is correct |
14 |
Correct |
415 ms |
37456 KB |
Output is correct |
15 |
Correct |
423 ms |
37020 KB |
Output is correct |
16 |
Correct |
398 ms |
37716 KB |
Output is correct |
17 |
Correct |
435 ms |
37164 KB |
Output is correct |
18 |
Correct |
379 ms |
36688 KB |
Output is correct |
19 |
Execution timed out |
13067 ms |
36476 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
692 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
616 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
533 ms |
40204 KB |
Output is correct |
13 |
Correct |
358 ms |
40016 KB |
Output is correct |
14 |
Correct |
468 ms |
37456 KB |
Output is correct |
15 |
Correct |
462 ms |
37140 KB |
Output is correct |
16 |
Correct |
361 ms |
37456 KB |
Output is correct |
17 |
Correct |
435 ms |
37200 KB |
Output is correct |
18 |
Correct |
380 ms |
36768 KB |
Output is correct |
19 |
Execution timed out |
13061 ms |
36324 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |