Submission #872783

#TimeUsernameProblemLanguageResultExecution timeMemory
872783bobbilykingSeparator (CEOI19_separator)C++17
100 / 100
974 ms111984 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...