Submission #204580

#TimeUsernameProblemLanguageResultExecution timeMemory
204580Sho10Strange Device (APIO19_strange_device)C++14
0 / 100
4909 ms524288 KiB
/* ID: Sho10 LANG: C++ */ #include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long int #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n,a,b,l,r,ans=0; map<pair<ll,ll>,ll>m; int32_t main(){ CODE_START; cin>>n>>a>>b; while(n--){ cin>>l>>r; for(ll i=l;i<=r;i++) { ll x,y; x=(i+i/b)%a; y=i%b; if(m[{x,y}]==0){ ans++; }else goto End; m[{x,y}]=1; } } End:cout<<ans<<endl; }
#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...