#include<bits/stdc++.h>
using namespace std;
#define ioss ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
int n, a, b;
signed main() {
ioss;
cin >> n >> a >> b;
int tmp = a*b;
vector<pii> idx;
for(int i = 0; i < n; i++) {
int l, r; cin >> l >> r;
idx.pb({l, r});
}
bool vis[tmp+1] = {};
memset(vis, 0, sizeof(vis));
for(int i = 0; i < n; i++) {
auto [l, r] = idx[i];
for(int j = l; j <= r; j++) vis[j%tmp] = 1;
}
int ans = 0;
for(int i = 0; i < tmp; i++) {
if(vis[i]) ans++;
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
10 ms |
6944 KB |
Output is correct |
3 |
Correct |
10 ms |
5844 KB |
Output is correct |
4 |
Incorrect |
1 ms |
700 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
5088 ms |
121100 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1236 KB |
Output is correct |
3 |
Correct |
8 ms |
1304 KB |
Output is correct |
4 |
Correct |
8 ms |
1108 KB |
Output is correct |
5 |
Execution timed out |
5062 ms |
17612 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
248 ms |
17184 KB |
Output is correct |
3 |
Runtime error |
415 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
248 ms |
17184 KB |
Output is correct |
3 |
Runtime error |
415 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
248 ms |
17184 KB |
Output is correct |
3 |
Runtime error |
415 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
180 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
10 ms |
6944 KB |
Output is correct |
3 |
Correct |
10 ms |
5844 KB |
Output is correct |
4 |
Incorrect |
1 ms |
700 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |