Submission #258911

#TimeUsernameProblemLanguageResultExecution timeMemory
258911parsa_mobedStrange Device (APIO19_strange_device)C++14
0 / 100
5075 ms48120 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e6 + 5; int l[N], r[N], mark[N]; int32_t main() { int n, A, B, ans = 0; cin >> n >> A >> B; A = A / __gcd(A, B + 1); for (int i = 0; i < n; i++) { cin >> l[i] >> r[i]; for (int j = l[i]; j <= r[i]; j++) if (!mark[j%(A*B)]) mark[j%(A*B)] = 1, ans++; } cout << ans << "\n"; return 0; }
#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...