답안 #65110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65110 2018-08-06T16:14:14 Z theknife2001 게임 (IOI13_game) C++17
0 / 100
13000 ms 118820 KB
#include "game.h"
#include <bits/stdc++.h>
#define mid (l+r)/2



using namespace std;


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;
}

const int N=1e5+55;
long long sp[20][N][15];
int lg[N];
int n,m;

void init(int R, int C)
{
    n=R;
    m=C;
    int j=0;
    for(int i=0;i<=m;i++)
    {
        if((1<<(j+1))==i)
            j++;
        lg[i]=j;
    }

}



void update(int P, int Q, long long K)
{
    sp[P][Q][0]=K;
    for(int i=1;i<=10;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(j+(1<<(i-1))>=m)
                break ;
            sp[P][j][i]=gcd2(sp[P][j+(1<<(i-1))][i-1],sp[P][j][i-1]);
        }
    }
}

long long calculate(int P, int Q, int U, int V)
{
    long long ans=0;
    for(int i=P;i<=U;i++)
    {
        ans=gcd2(sp[i][Q][lg[V-Q]],gcd2(sp[i][V-(1<<lg[V-Q])+1][lg[V-Q]],ans));
    }
    return ans;
}

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;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Runtime error 11 ms 612 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 612 KB Output is correct
2 Correct 3 ms 732 KB Output is correct
3 Correct 3 ms 732 KB Output is correct
4 Execution timed out 13014 ms 118820 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 118820 KB Output is correct
2 Runtime error 12 ms 118820 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 118820 KB Output is correct
2 Runtime error 11 ms 118820 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 118820 KB Output is correct
2 Runtime error 10 ms 118820 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -