Submission #142673

# Submission time Handle Problem Language Result Execution time Memory
142673 2019-08-10T12:02:56 Z Bodo171 Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include <iostream>
#include <set>
using namespace std;
set <long long > s;
long long n,i,j,l,r,A,B,per;
long long lim=1LL*1e18+1;
long long gcd(long long x,long long y)
{
    if((!x)||(!y)) return (x+y);
    return gcd(y,x%y);
}
int main()
{
    cin>>n>>A>>B;
    long long t=gcd(A,B+1);
    A/=t;
    long long per;
    if(lim/A<=B) per=lim;
    else per=1LL*A*B;
    for(i=1;i<=n;i++)
    {
        cin>>l>>r;
        for(j=l;j<=r;j++)
          s.insert(j%per);
    }
    cout<<s.size();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 70 ms 9728 KB Output is correct
3 Correct 104 ms 14004 KB Output is correct
4 Correct 4 ms 760 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 424 KB Output is correct
9 Correct 9 ms 1016 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 40 ms 5340 KB Output is correct
16 Correct 50 ms 5528 KB Output is correct
17 Correct 282 ms 5496 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Runtime error 4786 ms 524292 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 121 ms 24348 KB Output is correct
3 Correct 118 ms 24156 KB Output is correct
4 Correct 117 ms 23112 KB Output is correct
5 Execution timed out 5065 ms 46996 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2821 ms 47312 KB Output is correct
3 Runtime error 3071 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 376 KB Output is correct
2 Correct 2821 ms 47312 KB Output is correct
3 Runtime error 3071 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 376 KB Output is correct
2 Correct 2821 ms 47312 KB Output is correct
3 Runtime error 3071 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 3046 ms 524292 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 3 ms 348 KB Output is correct
2 Correct 70 ms 9728 KB Output is correct
3 Correct 104 ms 14004 KB Output is correct
4 Correct 4 ms 760 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 424 KB Output is correct
9 Correct 9 ms 1016 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 40 ms 5340 KB Output is correct
16 Correct 50 ms 5528 KB Output is correct
17 Correct 282 ms 5496 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Runtime error 4786 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -