# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
349698 |
2021-01-18T08:13:50 Z |
juggernaut |
Game (IOI13_game) |
C++14 |
|
154 ms |
256004 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){
for(int i=0;i<8000;i++)
for(int j=0;j<8000;j++)tree[i][j]=0ll;
}
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: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,1999,x,x2,y,y2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
144 ms |
256004 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
154 ms |
256004 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
144 ms |
256004 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
143 ms |
256004 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
145 ms |
256004 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |