Submission #962889

# Submission time Handle Problem Language Result Execution time Memory
962889 2024-04-14T09:23:40 Z n3rm1n Game (IOI13_game) C++17
37 / 100
731 ms 129880 KB
#include<bits/stdc++.h>
#include "game.h"
using namespace std;

long long r, c;
void init(int R, int C)
{
    r = R;
    c = C;
}
long long gcd2(long long X, long long Y) {
    long long tmp;
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}
long long t[105][400005];
long long line, ql, qr;
long long query(long long i, long long l, long long r)
{
    if(ql > r || qr < l)return 0;
    if(ql <= l && r <= qr)return t[line][i];
    long long mid = (l + r)/2;
    return gcd2(query(2*i, l, mid), query(2*i+1, mid+1, r));
}
long long pnt;
long long val;
void upd(long long i, long long l, long long r)
{
    if(l == r)
    {
        t[line][i] = val;
        return;
    }
    long long mid = (l + r)/2;
    if(pnt <= mid)upd(2*i, l, mid);
    else upd(2*i+1, mid+1, r);
    t[line][i] = gcd2(t[line][2*i], t[line][2*i+1]);
}
void update(int P, int Q, long long K)
{
    P ++;
    Q ++;

    line = P;
    pnt = Q;
    val = K;
    upd(1, 1, c);
}
long long calculate(int P, int Q, int U, int V)
{
    P ++;
    Q ++;
    U ++;
    V ++;
    long long ans = 0;
    ql = Q;
    qr = V;
    for (line = P; line <= U; ++ line)
        ans = gcd2(ans, query(1, 1, c));
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 55 ms 129620 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 17 ms 129880 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 39764 KB Output is correct
10 Correct 2 ms 9048 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 723 ms 24588 KB Output is correct
5 Correct 486 ms 24956 KB Output is correct
6 Correct 595 ms 21132 KB Output is correct
7 Correct 596 ms 34220 KB Output is correct
8 Correct 468 ms 19712 KB Output is correct
9 Correct 584 ms 21128 KB Output is correct
10 Correct 533 ms 20728 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 14 ms 129764 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 14 ms 129624 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 39772 KB Output is correct
10 Correct 2 ms 9052 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Runtime error 9 ms 4700 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 16 ms 129628 KB Output is correct
3 Correct 3 ms 7256 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 14 ms 129628 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 39772 KB Output is correct
10 Correct 2 ms 9048 KB Output is correct
11 Correct 2 ms 12888 KB Output is correct
12 Correct 726 ms 24628 KB Output is correct
13 Correct 528 ms 25012 KB Output is correct
14 Correct 571 ms 21328 KB Output is correct
15 Correct 563 ms 33876 KB Output is correct
16 Correct 488 ms 19760 KB Output is correct
17 Correct 628 ms 21164 KB Output is correct
18 Correct 536 ms 20736 KB Output is correct
19 Runtime error 8 ms 4700 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 15 ms 129628 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 14 ms 129628 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 6 ms 39772 KB Output is correct
10 Correct 2 ms 9052 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 731 ms 24728 KB Output is correct
13 Correct 475 ms 24916 KB Output is correct
14 Correct 611 ms 21364 KB Output is correct
15 Correct 606 ms 34008 KB Output is correct
16 Correct 470 ms 19860 KB Output is correct
17 Correct 582 ms 21032 KB Output is correct
18 Correct 556 ms 20572 KB Output is correct
19 Runtime error 9 ms 4700 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -