Submission #966600

# Submission time Handle Problem Language Result Execution time Memory
966600 2024-04-20T06:18:35 Z kilkuwu Strange Device (APIO19_strange_device) C++17
10 / 100
846 ms 524288 KB
#include <bits/stdc++.h>

#define nl '\n'


signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n;
  int64_t A, B;
  std::cin >> n >> A >> B;
  std::vector<int64_t> L(n), R(n);
  for (int i = 0; i < n; i++) {
    std::cin >> L[i] >> R[i];
  }

  auto calc = [&](int64_t t) -> std::pair<int64_t, int64_t> {
    auto y = t % B;
    auto x = (t + (t / B)) % A;
    return {x, y};
  };

  std::vector<std::pair<int64_t, int64_t>> shown;
  for (int i = 0; i < n; i++) {
    for (int64_t j = L[i]; j <= R[i]; j++) {
      shown.push_back(calc(j));
    }
  }

  std::sort(shown.begin(), shown.end());
  shown.erase(std::unique(shown.begin(), shown.end()), shown.end());
  std::cout << shown.size() << nl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 25 ms 6468 KB Output is correct
3 Correct 34 ms 10952 KB Output is correct
4 Correct 1 ms 736 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 7 ms 1500 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 33 ms 9044 KB Output is correct
16 Correct 14 ms 3184 KB Output is correct
17 Correct 35 ms 7772 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 451 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 63 ms 18376 KB Output is correct
3 Correct 77 ms 17736 KB Output is correct
4 Correct 68 ms 18120 KB Output is correct
5 Runtime error 631 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 323 ms 71356 KB Output is correct
3 Runtime error 846 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 323 ms 71356 KB Output is correct
3 Runtime error 846 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 323 ms 71356 KB Output is correct
3 Runtime error 846 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Runtime error 622 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 25 ms 6468 KB Output is correct
3 Correct 34 ms 10952 KB Output is correct
4 Correct 1 ms 736 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 7 ms 1500 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 33 ms 9044 KB Output is correct
16 Correct 14 ms 3184 KB Output is correct
17 Correct 35 ms 7772 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Runtime error 451 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -