Submission #62837

# Submission time Handle Problem Language Result Execution time Memory
62837 2018-07-30T12:48:53 Z mhnd Game (IOI13_game) C++14
0 / 100
3 ms 504 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;

ll seg[2010][4*2010],seg2[11][N];
int c,type;

long long gcd2(long long X, long long Y) {
    long long tmp;
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}

ll l,r,val,cur;
void update(int n,int s,int e){
    if(s > r || e < l)return;
    if(s == e){
        if(type)seg[cur][n] = val;
        else seg2[cur][n] = val;
        return;
    }
    update(n*2,s,(s+e)/2);
    update(n*2+1,(s+e)/2+1,e);
    if(type)seg[cur][n] = gcd2(seg[cur][n*2],seg[cur][n*2+1]);
    else seg2[cur][n] = gcd2(seg2[cur][n*2],seg2[cur][n*2+1]);
}

ll get(int n,int s,int e){
    if(s > r || e < l)return 0;
    if(s >= l && e <= r){
        if(type)return seg[cur][n];
        else return seg2[cur][n];
    }
    return gcd2(get(n*2,s,(s+e)/2),get(n*2+1,(s+e)/2+1,e));
}

void init(int R, int C) {
    type = R>10;
    c=C;
}

void update(int P, int Q, long long K) {
    l = r = Q;
    val = K;
    cur = P;
    update(1,1,c);
}

long long calculate(int P, int Q, int U, int V) {
    l = Q;
    r = V;
    for(int i=P;i<=U;i++){
        cur = i;
        update(1,1,c);
    }
    return get(1,1,c);
}

Compilation message

grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -