Submission #782140

# Submission time Handle Problem Language Result Execution time Memory
782140 2023-07-13T15:35:41 Z andecaandeci Strange Device (APIO19_strange_device) C++17
0 / 100
5000 ms 405144 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,b;
ll l[1000005],r[1000005];
int main(){
    scanf("%lld %lld %lld",&n,&a,&b);
    ll s=0;
    for (int i=1;i<=n;i++){
        scanf("%lld %lld",&l[i],&r[i]);
        s+=(r[i]-l[i])+1;
    }
    if (s<1000005){
        set<pair<ll,ll>> st;
        for (int i=1;i<=n;i++){
            for (int j=l[i];j<=r[i];j++){
                st.insert({(j+j/b)%a,j%b});
            }
        }
        printf("%lld",st.size());
    }
    // else if ()
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:20:20: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wformat=]
   20 |         printf("%lld",st.size());
      |                 ~~~^  ~~~~~~~~~
      |                    |         |
      |                    |         std::set<std::pair<long long int, long long int> >::size_type {aka long unsigned int}
      |                    long long int
      |                 %ld
strange_device.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld %lld %lld",&n,&a,&b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%lld %lld",&l[i],&r[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5081 ms 405144 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5070 ms 60576 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 273 ms 15836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 273 ms 15836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 273 ms 15836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 25 ms 1804 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5081 ms 405144 KB Time limit exceeded
3 Halted 0 ms 0 KB -