Submission #663042

# Submission time Handle Problem Language Result Execution time Memory
663042 2022-11-26T14:57:06 Z Ai7081 Strange Device (APIO19_strange_device) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>

const int N = 1e6 + 5;

ll n, a, b, loop, l, r;
set<pii> s;

ll gcd(ll c1, ll c2) {
    if (!(max(c1,c2)%min(c1,c2))) return min(c1, c2);
    return gcd(min(c1,c2), max(c1,c2)%min(c1,c2));
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> a >> b;
    loop = a*b/gcd(a,b+1);
    cin >> l >> r, l%=loop, r%=loop;
    cout << (l>r ? r+1+loop-l : r-l+1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -