Submission #979822

#TimeUsernameProblemLanguageResultExecution timeMemory
979822kaynStrange Device (APIO19_strange_device)C++14
0 / 100
5091 ms524288 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define run ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n, a, b, l, r, ans; map<ll, map<ll, bool>> cek; int main(){ run; cin >> n >> a >> b; while(n--){ cin >> l >> r; for(int t=l; t<=r; t++){ if(!cek[(t+t/b)%a][t%b]){ ans++; cek[(t+t/b)%a][t%b]=1; } } } cout << ans << endl; 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...