Submission #781777

# Submission time Handle Problem Language Result Execution time Memory
781777 2023-07-13T10:47:28 Z andecaandeci Strange Device (APIO19_strange_device) C++17
0 / 100
2712 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<int,int> > 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 19 ms 2512 KB Output is correct
3 Correct 28 ms 4556 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 5 ms 856 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 29 ms 4540 KB Output is correct
16 Correct 12 ms 1400 KB Output is correct
17 Correct 36 ms 1440 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 1 ms 212 KB Output is correct
2 Runtime error 718 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 55 ms 8648 KB Output is correct
3 Correct 76 ms 8580 KB Output is correct
4 Correct 62 ms 8644 KB Output is correct
5 Runtime error 645 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 326 ms 8652 KB Output is correct
3 Runtime error 718 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 326 ms 8652 KB Output is correct
3 Runtime error 718 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 326 ms 8652 KB Output is correct
3 Runtime error 718 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 2712 ms 263160 KB Output is correct
3 Runtime error 668 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 19 ms 2512 KB Output is correct
3 Correct 28 ms 4556 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 5 ms 856 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 29 ms 4540 KB Output is correct
16 Correct 12 ms 1400 KB Output is correct
17 Correct 36 ms 1440 KB Output is correct
18 Incorrect 0 ms 212 KB Output isn't correct
19 Halted 0 ms 0 KB -