답안 #65092

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65092 2018-08-06T15:16:35 Z theknife2001 게임 (IOI13_game) C++17
10 / 100
13000 ms 89956 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=2055;
long long sp[N][N*2][11];
int n,m;

void init(int R, int C)
{
    n=R;
    m=C;
}



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++)
        {
            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;
    int l=0;
    for(int i=10;i>=0;i--)
    {
        if((V-Q)&(1<<i))
        {
            l=i;
            break;
        }
    }
//    cout<<l<<endl;
    for(int i=P;i<=U;i++)
    {
//        cout<<sp[i][Q][l]<<' '<<sp[i][V-(1<<l)+1][l]<<endl;
        ans=gcd2(sp[i][Q][l],gcd2(sp[i][V-(1<<l)+1][l],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 2 ms 376 KB Output is correct
2 Correct 5 ms 1256 KB Output is correct
3 Correct 5 ms 1256 KB Output is correct
4 Correct 3 ms 1256 KB Output is correct
5 Correct 3 ms 1256 KB Output is correct
6 Correct 5 ms 1364 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 5 ms 1364 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 4 ms 1364 KB Output is correct
11 Correct 4 ms 1364 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1364 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Execution timed out 13107 ms 13208 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 13208 KB Output is correct
2 Correct 5 ms 13208 KB Output is correct
3 Correct 6 ms 13208 KB Output is correct
4 Correct 4 ms 13208 KB Output is correct
5 Correct 3 ms 13208 KB Output is correct
6 Correct 4 ms 13208 KB Output is correct
7 Correct 3 ms 13208 KB Output is correct
8 Correct 4 ms 13208 KB Output is correct
9 Correct 4 ms 13208 KB Output is correct
10 Correct 4 ms 13208 KB Output is correct
11 Correct 4 ms 13208 KB Output is correct
12 Execution timed out 13023 ms 89956 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 89956 KB Output is correct
2 Correct 7 ms 89956 KB Output is correct
3 Correct 6 ms 89956 KB Output is correct
4 Correct 2 ms 89956 KB Output is correct
5 Correct 3 ms 89956 KB Output is correct
6 Correct 5 ms 89956 KB Output is correct
7 Correct 2 ms 89956 KB Output is correct
8 Correct 3 ms 89956 KB Output is correct
9 Correct 5 ms 89956 KB Output is correct
10 Correct 4 ms 89956 KB Output is correct
11 Correct 3 ms 89956 KB Output is correct
12 Execution timed out 13041 ms 89956 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 89956 KB Output is correct
2 Correct 5 ms 89956 KB Output is correct
3 Correct 7 ms 89956 KB Output is correct
4 Correct 3 ms 89956 KB Output is correct
5 Correct 3 ms 89956 KB Output is correct
6 Correct 5 ms 89956 KB Output is correct
7 Correct 2 ms 89956 KB Output is correct
8 Correct 3 ms 89956 KB Output is correct
9 Correct 5 ms 89956 KB Output is correct
10 Correct 5 ms 89956 KB Output is correct
11 Correct 4 ms 89956 KB Output is correct
12 Execution timed out 13040 ms 89956 KB Time limit exceeded
13 Halted 0 ms 0 KB -