Submission #382908

#TimeUsernameProblemLanguageResultExecution timeMemory
382908abilStrange Device (APIO19_strange_device)C++14
10 / 100
5058 ms524292 KiB
#include <bits/stdc++.h>

#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define all(s) s.begin(),s.end()
#define int long long

using namespace std;

const int N = (1e6 + 12);
const int mod = (1e9 + 7);
const int inf = (1e9 + 7);

int l[N], r[N];

main(){
    SPEEDUP;
    int n, A, B;
    cin >> n >> A >> B;
    for(int i = 1; i <= n; i++){
        cin >> l[i] >> r[i];
    }
    set<pair<int,int >> st;
    for(int i = 1;i <= n; i++){
        for(int j = l[i], x, y; j <= r[i]; j++){
            x = ((j + (j + B - 1) / B) % A);
            y = j % B;
            st.insert({x, y});
        }
    }
    cout << st.size();
}

Compilation message (stderr)

strange_device.cpp:19:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main(){
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...