Submission #510629

# Submission time Handle Problem Language Result Execution time Memory
510629 2022-01-15T02:15:40 Z amukkalir Strange Device (APIO19_strange_device) C++17
10 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll; 
#define pii pair<int,int> 
#define fi first 
#define se second 
#define pb push_back 
#define mp make_pair

int n, a, b; 

signed main () {
    scanf("%d %d %d", &n, &a, &b); 
    set<pii> s; 
    for(int i=0; i<n; i++) {
        ll l, r; scanf("%lld %lld", &l, &r); 
        
        for(ll j = l; j <= r; j++) {
            ll x = (j + j/b) % a; 
            ll y = j % b; 
            //cerr << x << " " << y << endl; 
            s.insert(mp(x, y)); 
        }
    }

    ll ans = s.size(); 
    printf("%lld", ans); 
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d %d", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:16:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         ll l, r; scanf("%lld %lld", &l, &r);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 40 ms 9580 KB Output is correct
3 Correct 65 ms 13856 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 10 ms 992 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 292 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 204 KB Output is correct
15 Correct 35 ms 5276 KB Output is correct
16 Correct 31 ms 5472 KB Output is correct
17 Correct 91 ms 8616 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 4245 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 170 ms 24196 KB Output is correct
3 Correct 194 ms 24052 KB Output is correct
4 Correct 151 ms 23004 KB Output is correct
5 Execution timed out 5085 ms 46896 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 669 ms 84416 KB Output is correct
3 Runtime error 2461 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 Correct 669 ms 84416 KB Output is correct
3 Runtime error 2461 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 Correct 669 ms 84416 KB Output is correct
3 Runtime error 2461 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 2572 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 40 ms 9580 KB Output is correct
3 Correct 65 ms 13856 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 10 ms 992 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 292 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 204 KB Output is correct
15 Correct 35 ms 5276 KB Output is correct
16 Correct 31 ms 5472 KB Output is correct
17 Correct 91 ms 8616 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 4245 ms 524292 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -