#include<bits/stdc++.h>
using namespace std ;
#define endl '\n'
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define MOD 1000000007
int main ()
{
ll n,A,B;
cin>>n>>A>>B;
while(n--){
ll l,r;
cin>>l>>r;
set<pair<ll,ll>> s;
for(int i=l;i<=r;i++)
{
ll x= (i%A+((ll)floor(i/B))%A)%A;
ll y= (i%B);
s.insert(mp(x,y));
}
cout<<s.size()<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Execution timed out |
5094 ms |
405140 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
420 KB |
Output is correct |
2 |
Runtime error |
4403 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 |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5082 ms |
60632 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5061 ms |
77552 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5061 ms |
77552 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5061 ms |
77552 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Runtime error |
2278 ms |
524288 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 |
2 ms |
376 KB |
Output is correct |
2 |
Execution timed out |
5094 ms |
405140 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |