# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
349697 |
2021-01-18T08:12:35 Z |
juggernaut |
Game (IOI13_game) |
C++14 |
|
1 ms |
492 KB |
#include"game.h"
#include<bits/stdc++.h>
#ifndef EVAL
#include"grader.c"
#endif
using namespace std;
typedef long long ll;
ll tree[8000][8000];
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,1999,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,1999,x);
vector<int>v1=vec;
vec.clear();
upd(1,0,1999,y);
vector<int>v2=vec;
for(int to1:v2)
for(int to2:v1)tree[to1][to2]=__gcd(tree[to1][to2],val);
}
ll calculate(int x,int y,int x2,int y2){
return get(1,0,1999,x,x2,y,y2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |