Submission #781722

# Submission time Handle Problem Language Result Execution time Memory
781722 2023-07-13T10:22:48 Z makanhulia Strange Device (APIO19_strange_device) C++17
0 / 100
13 ms 960 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<bool> freq(1000005);
    for(int i=1;i<=n;i++){
        int l,r; cin>>l>>r;
        for(int j=l;j<=r;j++){
            freq[j%(a*b)]=1;
        }
    }

    set<pair<ll,ll> > sp;
    int cnt=0;
    for(int i=0;i<1000000;i++){
        if(freq[i]) {
            if(sp.count(make_pair((i+i/b)%a,i%b))) continue;
            sp.insert(make_pair((i+i/b)%a,i%b));
            cnt++;
        }
    }
    cout<<cnt<<'\n';


    return 0;
}

// ll gcd(ll a, ll b){
//     if(b==0) return a;
//     return gcd(b,a%b);
// }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 10 ms 960 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 13 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 13 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 13 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 3 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -