This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
  }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |