Submission #568719

# Submission time Handle Problem Language Result Execution time Memory
568719 2022-05-26T06:14:03 Z shrimb Strange Device (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")

#include"bits/stdc++.h"
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;

#define int long long
#define endl '\n'
#define mod 1000000007
//\
#define mod 1686876991

map<int, set<int>> mp;

signed main () {
    cin.tie(0)->sync_with_stdio(0);

    int n, a, b;
    cin >> n >> a >> b;

    int l[n], r[n];
    int ans = 0;
    for (int i = 0 ; i < n ; i++) {
        cin >> l[i] >> r[i];
        for (int t = l[i] ; t <= r[i] ; t++) {
            int x = (t + t / b) % a;
            int y = t % b;
            if (!(mp.count(x) and mp[x].count(y))) {
                ans++;
                mp[x].insert(y);
            }
        }
    }
    cout << ans << endl;
}

Compilation message

strange_device.cpp:17:1: warning: multi-line comment [-Wcomment]
   17 | //\
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 63 ms 9588 KB Output is correct
3 Correct 91 ms 13652 KB Output is correct
4 Correct 3 ms 724 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 9 ms 932 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 49 ms 5324 KB Output is correct
16 Correct 38 ms 5460 KB Output is correct
17 Correct 71 ms 6564 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 5061 ms 479268 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 Correct 221 ms 25340 KB Output is correct
3 Correct 176 ms 24024 KB Output is correct
4 Correct 165 ms 23136 KB Output is correct
5 Execution timed out 5041 ms 62652 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 693 ms 156836 KB Output is correct
3 Runtime error 1306 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 693 ms 156836 KB Output is correct
3 Runtime error 1306 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 693 ms 156836 KB Output is correct
3 Runtime error 1306 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 3227 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 63 ms 9588 KB Output is correct
3 Correct 91 ms 13652 KB Output is correct
4 Correct 3 ms 724 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 9 ms 932 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 49 ms 5324 KB Output is correct
16 Correct 38 ms 5460 KB Output is correct
17 Correct 71 ms 6564 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Execution timed out 5061 ms 479268 KB Time limit exceeded
21 Halted 0 ms 0 KB -