Submission #136660

#TimeUsernameProblemLanguageResultExecution timeMemory
136660KLPPStrange Device (APIO19_strange_device)C++14
10 / 100
5082 ms524292 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int lld; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) lld GCD(lld x, lld y){ if(y==0)return x; return GCD(y,x%y); } int main(){ lld n,A,B; cin>>n>>A>>B; lld l[n]; lld r[n]; rep(i,0,n)cin>>l[i]>>r[i]; lld D=GCD(A,B+1); set<pair<lld,lld> >s; rep(i,0,n){ for(lld j=l[i];j<=r[i];j++){ s.insert(pair<lld,lld>((j+(j/B))%A,j%B)); } } cout<<s.size()<<endl; //trav(a,s)cout<<a.first<<" "<<a.second<<endl; return 0; }

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:18:7: warning: unused variable 'D' [-Wunused-variable]
   lld D=GCD(A,B+1);
       ^
#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...