This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
struct Seggy{
vector<ll> s;
void init(int n){
s.resize(4 * n, 0);
}
void upd(int k,int tl,int tr,int p,ll v){
if(tl == tr){
s[k] = v;
return;
}
int tm = (tl + tr) / 2;
if(p <= tm)upd(k *2, tl, tm, p, v);
else upd(k *2 + 1, tm + 1, tr, p, v);
s[k] = gcd(s[k * 2], s[k * 2 + 1]);
}
ll qry(int k,int tl,int tr,int l,int r){
if(l > tr || tl > r)return 0;
if(l <= tl && tr <= r)return s[k];
int tm = (tl +tr) / 2;
return gcd(qry(k * 2,l, tm, l, r), qry(k *2 + 1, tm + 1, tr, l, r));
}
};
vector<Seggy> seg;
int n, m;
void init(signed R, signed C) {
n = R, m = C;
seg.resize(R);
for(auto &u: seg)u.init(C);
}
void update(signed P, signed Q, long long K) {
seg[P].upd(1, 0, m - 1, Q, K);
}
long long calculate(signed P, signed Q, signed U, signed V) {
int g = 0;
for(int i = P;i <= U;i++){
g = gcd(g, seg[i].qry(1, 0,m - 1,Q, V));
}
return g;
}
#define int signed
Compilation message (stderr)
game.cpp:56: warning: "int" redefined
56 | #define int signed
|
game.cpp:7: note: this is the location of the previous definition
7 | #define int long long
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |