Submission #529854

# Submission time Handle Problem Language Result Execution time Memory
529854 2022-02-23T19:12:49 Z ammar2000 Strange Device (APIO19_strange_device) C++17
10 / 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 (ll 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 Correct 54 ms 12600 KB Output is correct
3 Correct 85 ms 18256 KB Output is correct
4 Correct 3 ms 844 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 12 ms 1208 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 312 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 56 ms 6976 KB Output is correct
16 Correct 33 ms 7068 KB Output is correct
17 Correct 66 ms 10320 KB Output is correct
18 Correct 0 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 4549 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 182 ms 32316 KB Output is correct
3 Correct 210 ms 32076 KB Output is correct
4 Correct 173 ms 30540 KB Output is correct
5 Execution timed out 5042 ms 62564 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 584 ms 100124 KB Output is correct
3 Runtime error 2702 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 584 ms 100124 KB Output is correct
3 Runtime error 2702 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 584 ms 100124 KB Output is correct
3 Runtime error 2702 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 1963 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 Correct 54 ms 12600 KB Output is correct
3 Correct 85 ms 18256 KB Output is correct
4 Correct 3 ms 844 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 12 ms 1208 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 312 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 56 ms 6976 KB Output is correct
16 Correct 33 ms 7068 KB Output is correct
17 Correct 66 ms 10320 KB Output is correct
18 Correct 0 ms 316 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Runtime error 4549 ms 524292 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -