Submission #983034

# Submission time Handle Problem Language Result Execution time Memory
983034 2024-05-15T07:13:44 Z vjudge1 Strange Device (APIO19_strange_device) C++17
5 / 100
222 ms 15964 KB
#include<bits/stdc++.h>
#define sz size()
#define ll long long
using namespace std;

void out(__int128 a)
{
    string s;
    while(a)
        s += char(a % 10 + '0'),
        a /= 10;
    reverse(s.begin(), s.end());
    cout << s;
}

void solve()
{
    ll n, A, B, i, j, k;
    cin >> n >> A >> B;
    ll l[n + 1], r[n + 1];
    for(i = 1; i <= n; ++i)
        cin >> l[i] >> r[i];

    ll g = __gcd(A, B);
    __int128 x = A, y = B, z = g, x0 = (r[1] - l[1] + 1);
    x = x * y;
    if(x0 < x) x = x0;
    out(x);
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
}

Compilation message

strange_device.cpp: In function 'void solve()':
strange_device.cpp:18:20: warning: unused variable 'j' [-Wunused-variable]
   18 |     ll n, A, B, i, j, k;
      |                    ^
strange_device.cpp:18:23: warning: unused variable 'k' [-Wunused-variable]
   18 |     ll n, A, B, i, j, k;
      |                       ^
strange_device.cpp:25:28: warning: unused variable 'z' [-Wunused-variable]
   25 |     __int128 x = A, y = B, z = g, x0 = (r[1] - l[1] + 1);
      |                            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 516 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 222 ms 15964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 222 ms 15964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 222 ms 15964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 23 ms 2020 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -