Submission #987739

# Submission time Handle Problem Language Result Execution time Memory
987739 2024-05-23T14:05:32 Z 876pol Strange Device (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using pll = pair<ll, ll>;
template <class T>
using vec = vector<T>;
template <class T>
using indexed_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, s, e) for (ll i = (ll)s; i < (ll)e; i++)
#define CFOR(i, s, e) for (ll i = (ll)s; i <= (ll)e; i++)
#define TRAV(e, a) for (const auto &e : a)
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << "ln" << __LINE__ << ": " << #x << " = " << x << endl;

template <class T, class = decay_t<decltype(*begin(declval<T>()))>,
          class = enable_if_t<!is_same<T, string>::value>>
ostream &operator<<(ostream &out, const T &obj) {
    out << "[";
    for (auto it = obj.begin(); it != obj.end(); it++) {
        out << &", "[2 * (it == obj.begin())] << *it;
    }
    return out << "]";
}

template <class K, class V>
ostream &operator<<(ostream &out, const pair<K, V> &obj) {
    return out << "(" << obj.first << ", " << obj.second << ")";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    // FOR(i, 0, a * b) {
    //     cout << (i + (i / b)) % a << " "
    //          << i % b << "\n";
    // }
    set<pll> ss;
    FOR(i, 0, n) {
        ll l, r;
        cin >> l >> r;
        CFOR(t, l, r) {
            ss.insert({(t + (t / b)) % a, t % b});
        }
    }
    cout << ss.size() << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 41 ms 12804 KB Output is correct
3 Correct 89 ms 18436 KB Output is correct
4 Correct 2 ms 860 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 7 ms 1116 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 36 ms 6992 KB Output is correct
16 Correct 22 ms 7260 KB Output is correct
17 Correct 43 ms 10356 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 1843 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 135 ms 32300 KB Output is correct
3 Correct 204 ms 32084 KB Output is correct
4 Correct 128 ms 30804 KB Output is correct
5 Execution timed out 5010 ms 62564 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 438 ms 100136 KB Output is correct
3 Runtime error 1410 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 438 ms 100136 KB Output is correct
3 Runtime error 1410 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 438 ms 100136 KB Output is correct
3 Runtime error 1410 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Runtime error 1338 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 41 ms 12804 KB Output is correct
3 Correct 89 ms 18436 KB Output is correct
4 Correct 2 ms 860 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 7 ms 1116 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 36 ms 6992 KB Output is correct
16 Correct 22 ms 7260 KB Output is correct
17 Correct 43 ms 10356 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Runtime error 1843 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -