Submission #249441

#TimeUsernameProblemLanguageResultExecution timeMemory
249441jeqchoStrange Device (APIO19_strange_device)C++17
0 / 100
5092 ms524292 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define f first #define s second ll A,B; set<pii> ans; ll x(ll t) { return (t + t/B) % A; } ll y(ll t) { return t % B; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n>>A>>B; ll l,r; while(n--) { cin>>l>>r; FOR(t,l,r+1) { ans.insert({x(t),y(t)}); } } cout<<sz(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...