Submission #1090419

#TimeUsernameProblemLanguageResultExecution timeMemory
1090419vjudge1Game (IOI13_game)C++17
0 / 100
2 ms1628 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define int long long #define ar array 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,tl, tm, l, r), qry(k *2 + 1, tm + 1, tr, l, r)); } }; namespace Seggy2D{ vector<Seggy> seg; int n, m; void init(int _n,int _m){ n = _n, m = _m; seg.resize(4 * n); for(auto &u: seg)u.init(m); } void upd(int k,int tl,int tr,int p, ar<int, 2> v){ seg[k].upd(1, 0, m - 1, v[0], v[1]); if(tl == tr)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); } int qry(int k,int tl,int tr, int l,int r, ar<int, 2> v){ if(l > tr || tl > r)return 0; if(l <= tl && tr <= r)return seg[k].qry(1,0 ,m - 1, v[0], v[1]); int tm = (tl + tr) / 2; return __gcd(qry(k *2 ,tl, tm, l, r, v), qry(k *2 + 1, tm + 1, tr , l,r ,v )); } }; int n, m; void init(signed R, signed C) { n = R, m = C; Seggy2D::init(R, C); } void update(signed P, signed Q, long long K) { Seggy2D::upd(1, 0, n - 1, P, {Q, K}); } long long calculate(signed P, signed Q, signed U, signed V) { return Seggy2D::qry(1, 0, n - 1, P, U, {Q, V}); } #define int signed

Compilation message (stderr)

game.cpp:76: warning: "int" redefined
   76 | #define int signed
      | 
game.cpp:7: note: this is the location of the previous definition
    7 | #define int long long
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...