Submission #204578

# Submission time Handle Problem Language Result Execution time Memory
204578 2020-02-26T10:43:16 Z Sho10 Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
/*
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++;
}
m[{x,y}]=1;
}
}
cout<<ans<<endl;
}







# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 75 ms 12792 KB Output is correct
3 Correct 110 ms 18296 KB Output is correct
4 Correct 7 ms 888 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 18 ms 1272 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 380 KB Output is correct
13 Correct 5 ms 380 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 73 ms 7032 KB Output is correct
16 Correct 49 ms 7160 KB Output is correct
17 Correct 95 ms 10384 KB Output is correct
18 Correct 5 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Execution timed out 5024 ms 524292 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 227 ms 32404 KB Output is correct
3 Correct 270 ms 32120 KB Output is correct
4 Correct 197 ms 30584 KB Output is correct
5 Execution timed out 5072 ms 62584 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 743 ms 69212 KB Output is correct
3 Runtime error 3203 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 743 ms 69212 KB Output is correct
3 Runtime error 3203 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 743 ms 69212 KB Output is correct
3 Runtime error 3203 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Runtime error 2613 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 75 ms 12792 KB Output is correct
3 Correct 110 ms 18296 KB Output is correct
4 Correct 7 ms 888 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 18 ms 1272 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 380 KB Output is correct
13 Correct 5 ms 380 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 73 ms 7032 KB Output is correct
16 Correct 49 ms 7160 KB Output is correct
17 Correct 95 ms 10384 KB Output is correct
18 Correct 5 ms 504 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Execution timed out 5024 ms 524292 KB Time limit exceeded
21 Halted 0 ms 0 KB -