#include "game.h"
#include <bits/stdc++.h>
#define left_son (node<<1)
#define right_son ((node<<1)|1)
#define mid ((st+dr)>>1)
using namespace std;
typedef long long ll;
const int Nmax = 1e5 + 5;
int N, M;
ll ans;
ll gcd2(ll X, ll Y)
{
if(!Y) return X;
ll rest = X % Y;
while(rest)
X = Y, Y = rest, rest = X % Y;
return Y;
}
class SegTree
{
ll a[Nmax<<2];
public:
void update(int node, int st, int dr, int pos, ll val)
{
if(st == dr)
{
a[node] = val;
return;
}
if(pos <= mid) update(left_son, st, mid, pos, val);
else update(right_son, mid+1, dr, pos, val);
a[node] = gcd2(a[left_son], a[right_son]);
}
void query(int node, int st, int dr, int L, int R)
{
if(L <= st && dr <= R)
{
ans = gcd2(a[node], ans);
return;
}
if(L <= mid) query(left_son, st, mid, L, R);
if(mid < R) query(right_son, mid+1, dr, L, R);
}
} aint[12];
void init(int R, int C)
{
if(!(R <= 10 && C <= 100000)) exit(0);
N = R; M = C;
}
void update(int x, int y, ll K)
{
aint[x].update(1, 0, M-1, y, K);
}
ll calculate(int P, int Q, int U, int V)
{
int i, X1, X2, Y1, Y2;
X1 = min(P, U);
X2 = max(P, U);
Y1 = min(Q, V);
Y2 = max(Q, V);
ans = 0;
for(i=X1; i<=X2; ++i)
aint[i].query(1, 0, M-1, Y1, Y2);
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 |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
1565 ms |
25000 KB |
Output is correct |
5 |
Correct |
835 ms |
24696 KB |
Output is correct |
6 |
Correct |
1022 ms |
25952 KB |
Output is correct |
7 |
Correct |
1301 ms |
25680 KB |
Output is correct |
8 |
Correct |
1020 ms |
23896 KB |
Output is correct |
9 |
Correct |
1078 ms |
25616 KB |
Output is correct |
10 |
Correct |
1022 ms |
25328 KB |
Output is correct |
11 |
Correct |
3 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |