Submission #872783

# Submission time Handle Problem Language Result Execution time Memory
872783 2023-11-13T19:00:35 Z bobbilyking Separator (CEOI19_separator) C++17
100 / 100
974 ms 111984 KB
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include<bits/stdc++.h>
#include<math.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pl;

#define K first
#define V second
#define G(x) ll x; cin >> x;
#define GD(x) ld x; cin >> x;
#define GS(s) string s; cin >> s;
#define EX(x) { cout << x << '\n'; exit(0); }
#define A(a) (a).begin(), (a).end()
#define F(i, l, r) for (ll i = (l); i < r; ++i)

#define NN

constexpr ll MOD = 1e9;

int main(){
//    freopen("a.in", "r", stdin);
//    freopen("a.out", "w", stdout);

    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(20);
    set<ll> already;
    set<ll> candidates;
    G(n) 
    ll s = 0;
    while (n--) {
        G(b) ll a = (b + s)%MOD;
        // cout << "NSERTING " << a << endl;
        while (candidates.size() and *candidates.rbegin() > a) candidates.erase(*candidates.rbegin()); // if anything before me is greater than A, it's no longer a sepeartor
        if (already.empty() || *already.rbegin() < a) candidates.insert(a); // everything is less than me

        already.insert(a);
        s = candidates.size();
        cout << s << " "; cout << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 456 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 600 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 456 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 600 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 604 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 464 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 456 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 600 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 604 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 464 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 1 ms 600 KB Output is correct
79 Correct 1 ms 464 KB Output is correct
80 Correct 46 ms 10612 KB Output is correct
81 Correct 41 ms 5776 KB Output is correct
82 Correct 39 ms 5972 KB Output is correct
83 Correct 38 ms 5972 KB Output is correct
84 Correct 39 ms 5980 KB Output is correct
85 Correct 43 ms 5832 KB Output is correct
86 Correct 45 ms 5940 KB Output is correct
87 Correct 38 ms 5972 KB Output is correct
88 Correct 39 ms 5972 KB Output is correct
89 Correct 38 ms 5972 KB Output is correct
90 Correct 41 ms 5772 KB Output is correct
91 Correct 48 ms 6480 KB Output is correct
92 Correct 36 ms 6400 KB Output is correct
93 Correct 36 ms 6228 KB Output is correct
94 Correct 34 ms 6228 KB Output is correct
95 Correct 36 ms 6236 KB Output is correct
96 Correct 46 ms 6200 KB Output is correct
97 Correct 37 ms 6228 KB Output is correct
98 Correct 35 ms 6388 KB Output is correct
99 Correct 34 ms 6228 KB Output is correct
100 Correct 35 ms 6404 KB Output is correct
101 Correct 49 ms 11340 KB Output is correct
102 Correct 41 ms 11356 KB Output is correct
103 Correct 41 ms 11168 KB Output is correct
104 Correct 41 ms 11348 KB Output is correct
105 Correct 49 ms 11348 KB Output is correct
106 Correct 49 ms 11348 KB Output is correct
107 Correct 40 ms 11304 KB Output is correct
108 Correct 40 ms 11120 KB Output is correct
109 Correct 41 ms 11348 KB Output is correct
110 Correct 48 ms 11348 KB Output is correct
111 Correct 39 ms 5972 KB Output is correct
112 Correct 39 ms 5980 KB Output is correct
113 Correct 39 ms 5972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 456 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 600 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 600 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 604 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 464 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 1 ms 600 KB Output is correct
79 Correct 1 ms 464 KB Output is correct
80 Correct 46 ms 10612 KB Output is correct
81 Correct 41 ms 5776 KB Output is correct
82 Correct 39 ms 5972 KB Output is correct
83 Correct 38 ms 5972 KB Output is correct
84 Correct 39 ms 5980 KB Output is correct
85 Correct 43 ms 5832 KB Output is correct
86 Correct 45 ms 5940 KB Output is correct
87 Correct 38 ms 5972 KB Output is correct
88 Correct 39 ms 5972 KB Output is correct
89 Correct 38 ms 5972 KB Output is correct
90 Correct 41 ms 5772 KB Output is correct
91 Correct 48 ms 6480 KB Output is correct
92 Correct 36 ms 6400 KB Output is correct
93 Correct 36 ms 6228 KB Output is correct
94 Correct 34 ms 6228 KB Output is correct
95 Correct 36 ms 6236 KB Output is correct
96 Correct 46 ms 6200 KB Output is correct
97 Correct 37 ms 6228 KB Output is correct
98 Correct 35 ms 6388 KB Output is correct
99 Correct 34 ms 6228 KB Output is correct
100 Correct 35 ms 6404 KB Output is correct
101 Correct 49 ms 11340 KB Output is correct
102 Correct 41 ms 11356 KB Output is correct
103 Correct 41 ms 11168 KB Output is correct
104 Correct 41 ms 11348 KB Output is correct
105 Correct 49 ms 11348 KB Output is correct
106 Correct 49 ms 11348 KB Output is correct
107 Correct 40 ms 11304 KB Output is correct
108 Correct 40 ms 11120 KB Output is correct
109 Correct 41 ms 11348 KB Output is correct
110 Correct 48 ms 11348 KB Output is correct
111 Correct 39 ms 5972 KB Output is correct
112 Correct 39 ms 5980 KB Output is correct
113 Correct 39 ms 5972 KB Output is correct
114 Correct 29 ms 5972 KB Output is correct
115 Correct 605 ms 104304 KB Output is correct
116 Correct 899 ms 57172 KB Output is correct
117 Correct 925 ms 57164 KB Output is correct
118 Correct 931 ms 57312 KB Output is correct
119 Correct 874 ms 57172 KB Output is correct
120 Correct 897 ms 57340 KB Output is correct
121 Correct 903 ms 57184 KB Output is correct
122 Correct 974 ms 57172 KB Output is correct
123 Correct 886 ms 57492 KB Output is correct
124 Correct 903 ms 56960 KB Output is correct
125 Correct 847 ms 57160 KB Output is correct
126 Correct 466 ms 60212 KB Output is correct
127 Correct 487 ms 60084 KB Output is correct
128 Correct 498 ms 59948 KB Output is correct
129 Correct 462 ms 60244 KB Output is correct
130 Correct 465 ms 60184 KB Output is correct
131 Correct 483 ms 59892 KB Output is correct
132 Correct 465 ms 59920 KB Output is correct
133 Correct 463 ms 59988 KB Output is correct
134 Correct 455 ms 60244 KB Output is correct
135 Correct 470 ms 60132 KB Output is correct
136 Correct 552 ms 111644 KB Output is correct
137 Correct 538 ms 111880 KB Output is correct
138 Correct 543 ms 111852 KB Output is correct
139 Correct 542 ms 111984 KB Output is correct
140 Correct 549 ms 111620 KB Output is correct
141 Correct 531 ms 111700 KB Output is correct
142 Correct 544 ms 111616 KB Output is correct
143 Correct 544 ms 111700 KB Output is correct
144 Correct 559 ms 111644 KB Output is correct
145 Correct 528 ms 111836 KB Output is correct
146 Correct 335 ms 57100 KB Output is correct
147 Correct 916 ms 57324 KB Output is correct
148 Correct 921 ms 57012 KB Output is correct
149 Correct 906 ms 57036 KB Output is correct