Submission #810229

#TimeUsernameProblemLanguageResultExecution timeMemory
810229petezaStrange Device (APIO19_strange_device)C++14
0 / 100
5088 ms524288 KiB
#include <bits/stdc++.h> using namespace std; int n; long long a, b, mod; long long l, r, last=0, sum = 0; unordered_set<long long> s; int main() { cin.tie(0) -> sync_with_stdio(0); cin >> n >> a >> b; if(a >= 4e18/b) mod = 4e18; else mod = a*b; while(n--) { cin >> l >> r; for(int i=l,ct=l%mod;i<=r;i++,ct=(ct==mod-1?0:ct+1)) s.emplace(ct); } cout << s.size(); }
#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...