Submission #529760

# Submission time Handle Problem Language Result Execution time Memory
529760 2022-02-23T15:32:35 Z ammar2000 Strange Device (APIO19_strange_device) C++17
0 / 100
5000 ms 524292 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define coy cout<<"YES\n"
#define con cout<<"NO\n"
#define co1 cout<<"-1\n"
#define sc(x) scanf("%lld",&x)
#define all(x) x.begin(),x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int SI=3e5+7;
ll INF=8e18+7;
int dx[] = {1 , -1 , 0 , 0};
int dy[] = {0 , 0 , 1 , -1};
int MOD=1e9+7;
ll n,a,b;
ll ans=0;
map <pair < ll,ll>,ll> mp;
int main()
{
   fast
   cin>>n>>a>>b;
   for (int i=0;i<n;i++)
   {
       ll l,r;
       cin>>l>>r;
       for (int u=l;u<=r;u++)
       {
           ll x=(u+u/b)%a,y=u%b;
           if (mp[{x,y}]==0) ans++;
           mp[{x,y}]++;
       }
   }
   cout <<ans <<"\n";
   // use scanf not cin
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5065 ms 405136 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5015 ms 524292 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Execution timed out 5063 ms 60544 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5082 ms 77592 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5082 ms 77592 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5082 ms 77592 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Runtime error 2068 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5065 ms 405136 KB Time limit exceeded
3 Halted 0 ms 0 KB -