답안 #349705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
349705 2021-01-18T08:23:18 Z juggernaut 게임 (IOI13_game) C++14
0 / 100
1 ms 364 KB
#include"game.h"
#include<bits/stdc++.h>
#ifndef EVAL
#include"grader.c"
#endif
using namespace std;
typedef long long ll;
ll tree[400][400];
ll get_2(int v,int l,int r,int ql,int qr,int id){
    if(qr<l||r<ql)return 0ll;
    if(ql<=l&&r<=qr)
        return tree[id][v];
    int mid=(l+r)>>1;
    return __gcd(get_2(v<<1,l,mid,ql,qr,id),get_2(v<<1|1,mid+1,r,ql,qr,id));
}
ll get(int v,int l,int r,int ql,int qr,int u,int d){
    if(qr<l||r<ql)return 0ll;
    if(ql<=l&&r<=qr)
        return get_2(1,0,99,u,d,v);
    int mid=(l+r)>>1;
    return __gcd(get(v<<1,l,mid,ql,qr,u,d),get(v<<1|1,mid+1,r,ql,qr,u,d));
}
vector<int>vec;
void upd(int v,int l,int r,int pos){
    vec.push_back(v);
    if(l==r)return;
    int mid=(l+r)>>1;
    if(pos<=mid)upd(v<<1,l,mid,pos);
    else upd(v<<1|1,mid+1,r,pos);
}
void init(int n,int m){}
void update(int x,int y,ll val){
    vec.clear();
    upd(1,0,99,x);
    vector<int>v1=vec;
    vec.clear();
    upd(1,0,99,y);
    vector<int>v2=vec;
    for(int to1:v1)
        for(int to2:v2)tree[to1][to2]=__gcd(tree[to1][to2],val);
}
ll calculate(int x,int y,int x2,int y2){
    return get(1,0,99,x,x2,y,y2);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -