Submission #781781

# Submission time Handle Problem Language Result Execution time Memory
781781 2023-07-13T10:48:43 Z makanhulia Strange Device (APIO19_strange_device) C++17
0 / 100
537 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fi first
#define se second
#define pb push_back
#define TC int t; cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
//*AC BERSAMA ALLAH  FORTIS FORTUNA ADIUVAT
//# nyampah

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n,a,b; 
    cin>>n>>a>>b;

    vector<pair<ll,ll> > vec;
    for(int i=0;i<n;i++){
        ll l,r; cin>>l>>r;
        ll dec=a*b*(l/a/b);
        l-=dec; r-=dec;
        if(r-l>a*b) r=l+(a*b);
        for(int j=l;j<=r;j++){
            vec.push_back(make_pair(((j+j/b)%a),(j%b)));
        }
    }
    sort(all(vec));
    int sz=vec.size();
    ll cnt=0;
    for(int i=0;i<sz;i++){
        if(i>0 && vec[i]==vec[i-1]) continue;
        cnt++;
    }

    cout<<cnt;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 24 ms 4536 KB Output is correct
3 Correct 30 ms 8648 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 32 ms 8648 KB Output is correct
16 Correct 12 ms 2512 KB Output is correct
17 Correct 37 ms 2464 KB Output is correct
18 Incorrect 0 ms 212 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 537 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 59 ms 16844 KB Output is correct
3 Correct 70 ms 16840 KB Output is correct
4 Correct 73 ms 16936 KB Output is correct
5 Runtime error 469 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 346 ms 17028 KB Output is correct
3 Runtime error 505 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 346 ms 17028 KB Output is correct
3 Runtime error 505 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 346 ms 17028 KB Output is correct
3 Runtime error 505 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 511 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 24 ms 4536 KB Output is correct
3 Correct 30 ms 8648 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 32 ms 8648 KB Output is correct
16 Correct 12 ms 2512 KB Output is correct
17 Correct 37 ms 2464 KB Output is correct
18 Incorrect 0 ms 212 KB Output isn't correct
19 Halted 0 ms 0 KB -