답안 #1039445

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1039445 2024-07-30T21:50:17 Z ArthuroWich 게임 (IOI13_game) C++17
37 / 100
509 ms 30928 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int gcd2(int X, int Y) {
    int tmp;
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}
int seg[100][4*100005];
void update(int n, int l, int r, int i, int v, int id) {
    if (l == r) {
        seg[id][n] = v;
    } else {
        int m = (l+r)/2;
        if (l <= i && i <= m) {
            update(2*n, l, m, i, v, id);
        } else {
            update(2*n+1, m+1, r, i, v, id);   
        }
        seg[id][n] = gcd2(seg[id][2*n], seg[id][2*n+1]); 
    }
}
int query(int n, int l, int r, int a, int b, int id) {
    if (b < l || r < a) {
        return 0;
    } else if (a <= l && r <= b) {
        return seg[id][n];
    } else {
        int m = (l+r)/2;
        return gcd2(query(2*n, l, m, a, b, id), query(2*n+1, m+1, r, a, b, id));
    }
}
void init(int32_t R, int32_t C) {

}

void update(int32_t P, int32_t Q, int K) {
    update(1, 0, 100000, Q, K, P);
}
int calculate(int32_t P, int32_t Q, int32_t U, int32_t V) {
    int x = 0;
    for (int i = P; i <= U; i++) {
        x = gcd2(x, query(1, 0, 100000, Q, V, i));
    }
    return x;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 11452 KB Output is correct
3 Correct 3 ms 13660 KB Output is correct
4 Correct 0 ms 4540 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 3 ms 11356 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 2 ms 7100 KB Output is correct
10 Correct 2 ms 8024 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 509 ms 29160 KB Output is correct
5 Correct 396 ms 30804 KB Output is correct
6 Correct 355 ms 25912 KB Output is correct
7 Correct 362 ms 25936 KB Output is correct
8 Correct 345 ms 23888 KB Output is correct
9 Correct 385 ms 26628 KB Output is correct
10 Correct 380 ms 25428 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 7516 KB Output is correct
3 Correct 3 ms 7516 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 2 ms 7260 KB Output is correct
7 Correct 1 ms 2492 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 3 ms 9052 KB Output is correct
10 Correct 2 ms 10076 KB Output is correct
11 Correct 2 ms 7000 KB Output is correct
12 Runtime error 5 ms 4728 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 3 ms 11612 KB Output is correct
3 Correct 4 ms 9564 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 2 ms 11200 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 956 KB Output is correct
9 Correct 2 ms 9052 KB Output is correct
10 Correct 2 ms 8028 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 477 ms 30832 KB Output is correct
13 Correct 351 ms 30816 KB Output is correct
14 Correct 442 ms 25864 KB Output is correct
15 Correct 412 ms 27988 KB Output is correct
16 Correct 318 ms 23892 KB Output is correct
17 Correct 381 ms 26448 KB Output is correct
18 Correct 409 ms 25428 KB Output is correct
19 Runtime error 6 ms 4700 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 7356 KB Output is correct
3 Correct 3 ms 7516 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 2 ms 11196 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 3 ms 15196 KB Output is correct
10 Correct 3 ms 14172 KB Output is correct
11 Correct 2 ms 13144 KB Output is correct
12 Correct 500 ms 30928 KB Output is correct
13 Correct 381 ms 30788 KB Output is correct
14 Correct 393 ms 25940 KB Output is correct
15 Correct 384 ms 30016 KB Output is correct
16 Correct 320 ms 23888 KB Output is correct
17 Correct 402 ms 26448 KB Output is correct
18 Correct 326 ms 25424 KB Output is correct
19 Runtime error 6 ms 4700 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -