제출 #491998

#제출 시각아이디문제언어결과실행 시간메모리
491998nemethmSeparator (CEOI19_separator)C++17
90 / 100
1209 ms11228 KiB
#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<int> sep;
  int max_e = 0;
  for(int i = 0; i < n; ++i){
    int 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;
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...