Submission #131668

# Submission time Handle Problem Language Result Execution time Memory
131668 2019-07-17T12:27:39 Z Swan Strange Device (APIO19_strange_device) C++14
0 / 100
5000 ms 524292 KB
#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 = 1.0L*a*b;
    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

strange_device.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 109 ms 12528 KB Output is correct
3 Correct 174 ms 18052 KB Output is correct
4 Incorrect 5 ms 1016 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 5090 ms 338820 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 392 KB Output is correct
2 Correct 205 ms 32356 KB Output is correct
3 Correct 201 ms 32160 KB Output is correct
4 Correct 194 ms 30604 KB Output is correct
5 Execution timed out 5054 ms 62564 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2 ms 392 KB Output is correct
2 Correct 3089 ms 62896 KB Output is correct
3 Runtime error 4673 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 392 KB Output is correct
2 Correct 3089 ms 62896 KB Output is correct
3 Runtime error 4673 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 392 KB Output is correct
2 Correct 3089 ms 62896 KB Output is correct
3 Runtime error 4673 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Runtime error 4669 ms 524288 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 109 ms 12528 KB Output is correct
3 Correct 174 ms 18052 KB Output is correct
4 Incorrect 5 ms 1016 KB Output isn't correct
5 Halted 0 ms 0 KB -