제출 #966599

#제출 시각아이디문제언어결과실행 시간메모리
966599kilkuwu이상한 기계 (APIO19_strange_device)C++17
0 / 100
784 ms524288 KiB
#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 (int 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 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...