Submission #519136

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5191362022-01-25 18:02:44cadmiumsky이상한 기계 (APIO19_strange_device)C++14
35 / 100
1751 ms100200 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int a,b,q;
bool ok = 0;
cin >> q >> a >> b;
map<int,int> smen;
int per = a * b / __gcd(b + 1, a); // formula magica care e motivata din.. niste calcule de clasa a 7a de algebra modulara O_o
if(log2((double)a / (double)__gcd(b + 1, a)) + log2(b) > 60)
per = 1e18 + 1;
for(int i = 0, cl, cr, l, r; i < q; i ++) {
cin >> l >> r;
cl = per * ceil((double)l / (double)per);
cr = per * floor((double)r / (double)per);
if(cl < cr) {
ok = 1;
}
if(cl == cr && l < cl && cr <= r) {
l %= per;
r %= per;
smen[l]++;
smen[0]++;
smen[r + 1]--;
//cout << l << ' '<< -per - 1 << '\n' << 0 << ' ' << r << '\n';
}
else {
l %= per;
r %= per;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...