답안 #781709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781709 2023-07-13T10:18:35 Z kebine 이상한 기계 (APIO19_strange_device) C++17
0 / 100
14 ms 952 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;
        if(r-l>a*b) r=l+a*b;
        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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 2 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 10 ms 952 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 14 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 14 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 14 ms 444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Incorrect 4 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 2 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -