Submission #440360

# Submission time Handle Problem Language Result Execution time Memory
440360 2021-07-02T07:19:16 Z VladM Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>

using namespace std;

#define DIM 1000007

typedef pair<long long, long long> pll;

long long n, A, B, l[DIM], r[DIM];

set<pll> s;

int main()
{
    cin>>n>>A>>B;
    for(int i=1; i<=n; i++)
    {
        cin>>l[i]>>r[i];
    }
    for(int i=1; i<=n; i++)
    {
        for(long long t=l[i]; t<=r[i]; t++)
        {
            s.insert({(t+t/B)%A, t%B});
            if(B==1)
            {
                if(A%2==0 && s.size()==A/2) break;
                if(A%2==1 && s.size()==A) break;
            }
            if(s.size()==A*B) break;
        }
    }
    cout<<s.size();
    return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:27:38: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   27 |                 if(A%2==0 && s.size()==A/2) break;
      |                              ~~~~~~~~^~~~~
strange_device.cpp:28:38: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   28 |                 if(A%2==1 && s.size()==A) break;
      |                              ~~~~~~~~^~~
strange_device.cpp:30:24: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   30 |             if(s.size()==A*B) break;
      |                ~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 60 ms 12412 KB Output is correct
3 Correct 85 ms 18112 KB Output is correct
4 Correct 2 ms 844 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 9 ms 1100 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 44 ms 6936 KB Output is correct
16 Correct 44 ms 6828 KB Output is correct
17 Correct 196 ms 8276 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 2488 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 161 ms 32384 KB Output is correct
3 Correct 232 ms 31940 KB Output is correct
4 Correct 137 ms 30488 KB Output is correct
5 Execution timed out 5072 ms 78092 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1649 ms 78668 KB Output is correct
3 Runtime error 3490 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1649 ms 78668 KB Output is correct
3 Runtime error 3490 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1649 ms 78668 KB Output is correct
3 Runtime error 3490 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 1871 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 60 ms 12412 KB Output is correct
3 Correct 85 ms 18112 KB Output is correct
4 Correct 2 ms 844 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 9 ms 1100 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 44 ms 6936 KB Output is correct
16 Correct 44 ms 6828 KB Output is correct
17 Correct 196 ms 8276 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Runtime error 2488 ms 524292 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -