Submission #707857

# Submission time Handle Problem Language Result Execution time Memory
707857 2023-03-10T10:21:48 Z veehj Strange Device (APIO19_strange_device) C++17
15 / 100
4306 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()

int main() {
  ll n, a, b; cin >> n >> a >> b;
  map<pair<ll, ll>, ll> mp;
  ll cnt=0;
  while(n--){
    ll l, r; cin >> l >> r;
    while(l<=r){
        if(!mp[{(l+(l/b))%a, l%b}]){
            mp[{(l+(l/b))%a, l%b}]=r-l+1;
            l++; cnt++;
        }
        else l+=mp[{(l+(l/b))%a, l%b}];
    }
  }
  cout << cnt;
} 
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 68 ms 12564 KB Output is correct
3 Correct 96 ms 18252 KB Output is correct
4 Correct 3 ms 852 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 4 ms 1192 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 304 KB Output is correct
12 Correct 1 ms 304 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 34 ms 6988 KB Output is correct
16 Correct 45 ms 6984 KB Output is correct
17 Correct 151 ms 10188 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 4306 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 162 ms 32192 KB Output is correct
3 Correct 198 ms 32072 KB Output is correct
4 Correct 141 ms 30540 KB Output is correct
5 Correct 1204 ms 87968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1396 ms 67064 KB Output is correct
3 Runtime error 2573 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1396 ms 67064 KB Output is correct
3 Runtime error 2573 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1396 ms 67064 KB Output is correct
3 Runtime error 2573 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 1886 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 68 ms 12564 KB Output is correct
3 Correct 96 ms 18252 KB Output is correct
4 Correct 3 ms 852 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 4 ms 1192 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 304 KB Output is correct
12 Correct 1 ms 304 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 34 ms 6988 KB Output is correct
16 Correct 45 ms 6984 KB Output is correct
17 Correct 151 ms 10188 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Runtime error 4306 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -