Submission #131670

#TimeUsernameProblemLanguageResultExecution timeMemory
131670Swan이상한 기계 (APIO19_strange_device)C++14
0 / 100
5122 ms524292 KiB
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve2.txt","w",stdout)
#define int long long
#define double long double
using namespace std;


map<int,int> m;

main()
{
    int n,a,b; cin >> n >> a >> b;
    double kek = a*b/__gcd(a,b+1);
    int lcm;
    if(kek >= 1e18+228)lcm = 1e18+228;
    else lcm = a*b;
    int res = 0;
    assert(lcm != 1e18+228);
    for(int i(0); i < n;i++){
        int l,r; cin >> l >> r;
        for(int j(l);j<=r;j++){
            if(m[j%lcm] == 0)res++;
            m[j%lcm]++;
        }
    }
    cout << res;
    return 0;
}
/*
5
1 1
1 4
4 1
4 4
2 2
*/

Compilation message (stderr)

strange_device.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 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...