#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define mk make_pair
#define pb push_back
#define __fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
map<pair<ll,ll>,ll> mp;
int main(){
__fast
ll n,a,b;
cin>>n>>a>>b;
for(int i=1; i<=n; i++){
ll l,r;
cin>>l>>r;
for(ll j=l; j<=r; j++){
ll x=(j+j/b)%a;
ll y=j%b;
mp[mk(x,y)]++;
}
}
cout<<mp.size();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
50 ms |
12700 KB |
Output is correct |
3 |
Correct |
72 ms |
18220 KB |
Output is correct |
4 |
Correct |
2 ms |
832 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 |
8 ms |
1100 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
42 ms |
6980 KB |
Output is correct |
16 |
Correct |
30 ms |
7088 KB |
Output is correct |
17 |
Correct |
67 ms |
8268 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Runtime error |
3240 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
141 ms |
32216 KB |
Output is correct |
3 |
Correct |
191 ms |
32056 KB |
Output is correct |
4 |
Correct |
126 ms |
30532 KB |
Output is correct |
5 |
Execution timed out |
5065 ms |
62528 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
607 ms |
66696 KB |
Output is correct |
3 |
Runtime error |
2107 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
607 ms |
66696 KB |
Output is correct |
3 |
Runtime error |
2107 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
607 ms |
66696 KB |
Output is correct |
3 |
Runtime error |
2107 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Runtime error |
1718 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
50 ms |
12700 KB |
Output is correct |
3 |
Correct |
72 ms |
18220 KB |
Output is correct |
4 |
Correct |
2 ms |
832 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 |
8 ms |
1100 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
42 ms |
6980 KB |
Output is correct |
16 |
Correct |
30 ms |
7088 KB |
Output is correct |
17 |
Correct |
67 ms |
8268 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Runtime error |
3240 ms |
524292 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |