Submission #349699

# Submission time Handle Problem Language Result Execution time Memory
349699 2021-01-18T08:15:19 Z juggernaut Game (IOI13_game) C++14
0 / 100
20 ms 31724 KB
#include"game.h"
#include<bits/stdc++.h>
#ifndef EVAL
#include"grader.c"
#endif
using namespace std;
typedef long long ll;
const int sz=2000;
ll tree[sz][sz];
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){
    for(int i=0;i<sz;i++)
    for(int j=0;j<sz;j++)tree[i][j]=0ll;
}
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);
}
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 31596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 31596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 31632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 31596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 31724 KB Output isn't correct
2 Halted 0 ms 0 KB -