Submission #7247

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
72472014-07-28 13:04:41RhakGame (IOI13_game)C++98
63 / 100
4540 ms256000 KiB
#include "game.h"
#include<stdio.h>
long long gcd2(long long x, long long y){ return y==0? x: gcd2(y, x%y); }
struct _node{
_node *d[4];
long long GCD;
_node(long long GCD):GCD(GCD){ d[0] = d[1] = d[2] = d[3] = 0; }
};
struct _IndexTree{
int S, E;
_node *root;
_IndexTree(int S,int E):S(S), E(E){ root = new _node(0);}
void update(_node* n, int s, int e, int p, long long N, _IndexTree* l, _IndexTree* r)
{
if( p < s || e < p) return;
else if( p == s && e == p){
if( N != -1) n->GCD = N;
else n->GCD = gcd2(l?l->read(s, e):0, r?r->read(s, e):0);
return;
}
long long t[4] = {0}, fn = 0;
for(int i = 0; i < 4; i++) t[i] = n->d[i]? n->d[i]->GCD:0;
if( e >= s+4){
for(long long i = 0; i < 4; i++){
int ml = (( s*(4-i) + e*i) >> 2) + 1;
int mr = ( s*(3-i) + e*(i+1)) >> 2;
if(i == 0) ml--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...