Submission #491997

#TimeUsernameProblemLanguageResultExecution timeMemory
491997nemethmSeparator (CEOI19_separator)C++17
90 / 100
1284 ms15208 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <cstdint> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> #include <deque> #include <set> #include <map> #include <stack> #include <string> #include <limits> #include <assert.h> #include <cmath> #include <algorithm> using namespace std; using ll = long long int; const ll mod = 1e9; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); int n; cin >> n; stack<ll> sep; ll max_e = 0; for(int i = 0; i < n; ++i){ ll b; cin >> b; b = (b + sep.size()) % mod; max_e = max(max_e, b); while(!sep.empty() && sep.top() >= b){ sep.pop(); } if(max_e == b) sep.push(b); cout << sep.size() << endl; } }

Compilation message (stderr)

separator.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
separator.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...