제출 #1031699

#제출 시각아이디문제언어결과실행 시간메모리
1031699stdfloat이상한 기계 (APIO19_strange_device)C++17
0 / 100
3822 ms524288 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; ll A, B; cin >> n >> A >> B; int L = 0; set<pair<int, int>> s; for (int i = 1; ; i++) { int x = (i + i / B) % A, y = i % B; if (s.find({x, y}) != s.end()) { L = i - 1; break; } s.insert({x, y}); } vector<int> p(L + 1); while (n--) { int l, r; cin >> l >> r; if (L <= r - l + 1) { p[0]++; continue; } p[l % L]++; p[r % L + 1]--; if (l % L > r % L) p[0]++; } int cnt = 0; for (int i = 0; i < L; i++) { p[i] += p[i - 1]; cnt += !!p[i]; } cout << cnt; }
#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...