답안 #1090297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090297 2024-09-18T07:59:43 Z vjudge1 게임 (IOI13_game) C++17
0 / 100
1 ms 1116 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int long long

struct Seggy{
    vector<ll> s;

    void init(int n){
        s.resize(4 * n, 0);
    }

    void upd(int k,int tl,int tr,int p,ll v){
        if(tl == tr){
            s[k] = v;
            return;
        }
        int tm = (tl + tr) / 2;
        if(p <= tm)upd(k *2, tl, tm, p, v);
        else upd(k *2 + 1, tm + 1, tr, p, v);
        s[k] = gcd(s[k * 2], s[k * 2 + 1]);
    }

    ll qry(int k,int tl,int tr,int l,int r){
        if(l > tr || tl > r)return 0;
        if(l <= tl && tr <= r)return s[k];
        int tm = (tl +tr) / 2;
        return gcd(qry(k * 2,l, tm, l, r), qry(k *2 + 1, tm + 1, tr, l, r));
    }
};

vector<Seggy> seg;

int n, m;

void init(signed R, signed C) {
    n = R, m = C;
    seg.resize(R);
    for(auto &u: seg)u.init(C);
}

void update(signed P, signed Q, long long K) {
    seg[P].upd(1, 0, m - 1, Q, K);
}

long long calculate(signed P, signed Q, signed U, signed V) {
    int g = 0;
    for(int i = P;i <= U;i++){
        g = gcd(g, seg[i].qry(1, 0,m - 1,Q, V));
    }
    return g;
}
#define int signed

Compilation message

game.cpp:56: warning: "int" redefined
   56 | #define int signed
      | 
game.cpp:7: note: this is the location of the previous definition
    7 | #define int long long
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 1 ms 1116 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 1116 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Runtime error 1 ms 1112 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 1 ms 1116 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -