Submission #221613

# Submission time Handle Problem Language Result Execution time Memory
221613 2020-04-10T14:14:58 Z MKopchev Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e6+42;
const long long inf=1e18;

int n;
long long A,B;

pair<long long,long long> inp[nmax];

set< pair<long long,long long> > active;

int main()
{
    scanf("%i%lld%lld",&n,&A,&B);

    A=A/__gcd(A,B+1);

    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&inp[i].first,&inp[i].second);

        for(long long j=inp[i].first;j<=inp[i].second;j++)
        {
            long long num=j;

            if(A<=inf/B)num=num%(A*B);

            active.insert({num/B,num%B});
        }
    }

    printf("%i\n",active.size());
    return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:33:32: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::set<std::pair<long long int, long long int> >::size_type {aka long unsigned int}' [-Wformat=]
     printf("%i\n",active.size());
                   ~~~~~~~~~~~~~^
strange_device.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%lld%lld",&n,&A,&B);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&inp[i].first,&inp[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 53 ms 12920 KB Output is correct
3 Correct 86 ms 18448 KB Output is correct
4 Correct 6 ms 896 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 11 ms 1256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 44 ms 7032 KB Output is correct
16 Correct 31 ms 7288 KB Output is correct
17 Correct 74 ms 11896 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Runtime error 2596 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 5 ms 256 KB Output is correct
2 Correct 133 ms 32504 KB Output is correct
3 Correct 122 ms 32248 KB Output is correct
4 Correct 120 ms 30712 KB Output is correct
5 Execution timed out 5089 ms 62584 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 734 ms 115828 KB Output is correct
3 Runtime error 2058 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 5 ms 256 KB Output is correct
2 Correct 734 ms 115828 KB Output is correct
3 Runtime error 2058 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 5 ms 256 KB Output is correct
2 Correct 734 ms 115828 KB Output is correct
3 Runtime error 2058 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 5 ms 384 KB Output is correct
2 Runtime error 2103 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 8 ms 256 KB Output is correct
2 Correct 53 ms 12920 KB Output is correct
3 Correct 86 ms 18448 KB Output is correct
4 Correct 6 ms 896 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 11 ms 1256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 44 ms 7032 KB Output is correct
16 Correct 31 ms 7288 KB Output is correct
17 Correct 74 ms 11896 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Runtime error 2596 ms 524288 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -