Submission #1263788

#TimeUsernameProblemLanguageResultExecution timeMemory
1263788aren_danceGame (IOI13_game)C++20
63 / 100
13093 ms5048 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <set> #include <map> #include "game.h" #define ll long long using namespace std; vector<pair<pair<int, int>,ll>> g; ll gcd(ll x,ll y) { if (x > y) { swap(x, y); } if (x == 0) { return y; } if (y % x == 0) { return x; } return gcd(y%x,x); } void init(int R, int C) { } void update(int P, int Q, long long K) { for (int i = 0;i <int(g.size());++i) { if (g[i].first.first == P && g[i].first.second == Q) { g[i].second = K; return; } } g.push_back({ {P,Q},K }); } long long calculate(int P, int Q, int U, int V) { ll answ = 0; ll x = log2(V - Q + 1); for (auto i : g) { if (i.first.first >= P && i.first.first <= U && i.first.second >= Q && i.first.second <= V) { answ = gcd(answ, i.second); } } return answ; }
#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...