Problem:
Trampoline
A plurality of trampolines are arranged in a line at 10 m intervals. Each trampoline has its own maximum horizontal distance within which the jumper can jump safely. Starting from the left-most trampoline, the jumper jumps to another trampoline within the allowed jumping range. The jumper wants to repeat jumping until he/she reaches the right-most trampoline, and then tries to return to the left-most trampoline only through jumping. Can the jumper complete the roundtrip without a single stepping-down from a trampoline?
Write a program to report if the jumper can complete the journey using the list of maximum horizontal reaches of these trampolines. Assume that the trampolines are points without spatial extent.
Input
The input is given in the following format.
N
d_1
d_2
:
d_N
The first line provides the number of trampolines
N
(2 ≤
N
≤ 3 × 10
5
). Each of the subsequent
N
lines gives the maximum allowable jumping distance in integer meters for the
i
-th trampoline
d_i
(1 ≤
d_i
≤ 10
6
).
Output
Output "
yes
" if the jumper can complete the roundtrip, or "
no
" if he/she cannot.
Sample Input 1
4
20
5
10
1
Sample Output 1
no
Sample Input 2
3
10
5
10
Sample Output 2
no
Sample Input 3
4
20
30
1
20
Sample Output 3
yes

Submitted solutions:

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ld=long double;
#define fi first
#define se second
#define i128 __int128_t
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define si(a) (long)(a.size())
template<typename T>bool chmin(T&a,T b){return b<a?(a=b,1):0;}
template<typename T>bool chmax(T&a,T b){return b>a?(a=b,1):0;}
const int INF=1e9+100;
const long INFL=3e18+100;
struct _ {
   _() { cin.tie(0)->sync_with_stdio(0), cout.tie(0); }
} __;


int main(){
    
    int N;
    cin>>N;
    vector<int> D(N);
    rep(i,N)cin>>D[i],D[i]/=10;
    

    rep(_,2){
        int ma=0;
        rep(i,N){
            if(i<=ma){
                chmax(ma, i+D[i]);
            }
        }
        if(ma<N-1){
            cout<<"no\n";
            return 0;
        }

        reverse(all(D));
    }
    cout<<"yes\n";

}
accuracy: 1
time_ms: 10
memory_kb: 4480
final_rank: 1

code_snippet: #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i=0;i<(ll)(N);i++)
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int N;cin>>N;
    vector<ll>D(N);
    rep(i,N)cin>>D[i];
    ll v = 0;
    rep(i,N){
        if(v>=i*10){
            v = max(v,i*10+D[i]);
        }
        else {
            cout<<"no"<<endl;
            return 0;
        }
    }
    v = (N-1)*10;
    for(int i=N-1;i>=0;i--){
        if(v<=i*10){
            v = min(v,i*10-D[i]);
        }
        else{
            cout<<"no"<<endl;
            return 0;
        }
    }
    cout<<"yes"<<endl;
}
accuracy: 1
time_ms: 50
memory_kb: 5392
final_rank: 4

code_snippet: #include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
#define rep(i,n) for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; i>=0; i--)
#define print(a) cout<<a<<endl
typedef long long ll;
#define yn(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YN(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define so(a) sort(a.begin(),a.end())
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define pb push_back
#define a2i(a,s) (ll)(a-s)
#define i2a(s,a) (char)(s+a)
#define ssize(a) a.size()
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<pair<ll,ll>,pair<ll,ll>> P4;

typedef pair<ll, ll> Pll;
typedef pair<ll,Pll> Plll;
typedef pair<Pii, int> Piii;
const ll INF = 1000000000000000000;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//vector<ll> saiki(ll bit,ll n){
//	vector<ll> s(n);
//	for(ll i=0;i<n;i++){
//		if(bit&(1<<i)){
//			s[i]=1;
//		}else s[i]=0;
//	}
//	return s;
//}
int main(){
//入力

	cin.tie(0);
	ios::sync_with_stdio(0);

	ll n;
	cin>>n;
	vector<ll> a(n);
	rep(i,n)cin>>a[i];

	vector<ll> ans(n+1,0);
	vector<ll> ans2(n+1,0);

	for(ll i=0;i<n-1;i++){
		ll v=a[i]/10;
		if(a[i]>=10){
			ans[i+1]+=1;
			ans[min(i+1+v,n)]-=1;
		}
	}
	for(ll i=n-1;i>=1;i--){
		ll v=a[i]/10;
		if(a[i]>=10){
			ans2[i]+=1;
			ans2[max(i-v,n-n)]-=1;
		}
	}
	for(ll i=1;i<n-1;i++){
		ans[i]=ans[i-1]+ans[i];
		if(ans[i]==0){
			cout<<"no"<<endl;
			return 0;
		}
	}
	for(ll i=n-1;i>=1;i--){
		ans2[i]=ans2[i+1]+ans2[i];
		if(ans2[i]==0){
			cout<<"no"<<endl;
			return 0;
		}
	}
	cout<<"yes"<<endl;

	return 0;

}
accuracy: 1
time_ms: 10
memory_kb: 10184
final_rank: 7

code_snippet: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool JG(vector<int> D) {
	int N = D.size();
	int mx = D[0];
	for (int i = 1;i < N;i++) {
		if (i <= mx) {
			mx = max(mx, i + D[i]);
		} else {
			return false;
		}
	}
	return true;
}
int main() {
	int N;cin >> N;
	vector<int> D(N);
	for (int i = 0;i < N;i++) {
		cin >> D[i];
		D[i] /= 10;
	}
	if (!JG(D)) {
		cout << "no" << endl;
		return 0;
	}
	reverse(D.begin(), D.end());
	if (JG(D)) {
		cout << "yes" << endl;
	} else {
		cout << "no" << endl;
	}
}
accuracy: 1
time_ms: 40
memory_kb: 5728
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

bool solve(vector<int> &D, int N) {
    int maxi = 0;
    rep(i, 0, N) {
        if (i*10 <= maxi) maxi = max(maxi, i*10 + D[i]);
    }
    return ((N - 1)*10 <= maxi);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;
    vector<int> D(N), invD(N);
    rep(i, 0, N) {
        cin >> D[i];
        invD[N - i - 1] = D[i];
    }
    
    if (solve(D, N) && solve(invD, N)) cout << "yes\n";
    else cout << "no\n";
}
accuracy: 1
time_ms: 10
memory_kb: 5424
final_rank: 2

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

bool solve(vector<int> &D, int N) {
    int maxi = 0;
    rep(i, 0, N) {
        if (i*10 <= maxi) maxi = max(maxi, D[i]);
    }
    return ((N - 1)*10 <= maxi);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;
    vector<int> D(N), invD(N);
    rep(i, 0, N) {
        cin >> D[i];
        invD[N - i - 1] = D[i];
    }
    
    if (solve(D, N) && solve(invD, N)) cout << "yes\n";
    else cout << "no\n";
}
accuracy: 0.175
time_ms: 10
memory_kb: 5272
final_rank: 20

code_snippet: #include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=10000000;
const ll INF=1000000001;
const ll LINF=4000000000000000010;
const double EPS=1e-9;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int d[300010];
int ma[300010],mi[300010];
int main(){
    int n;cin>>n;
    for(int i=0;i<n;i++){
        cin>>d[i];
        d[i]/=10;
        if(i){
            ma[i]=max(ma[i-1],i+d[i]);
        }else{
            ma[i]=i+d[i];
        }
    }
    fill(mi,mi+n,INF);
    for(int i=n-1;i>=0;i--){
        if(i<n-1){
            mi[i]=min(mi[i+1],i-d[i]);
        }else{
            mi[i]=i-d[i];
        }
    }
    int pos=0;
    while(pos<n-1){
        if(pos==ma[pos]){
            cout<<"no"<<endl;
            return 0;
        }
        pos=ma[pos];
    }
    pos=n-1;
    while(pos>0){
        if(pos==mi[pos]){
            cout<<"no"<<endl;
            return 0;
        }
        pos=mi[pos];
    }
    cout<<"yes"<<endl;
}
accuracy: 1
time_ms: 50
memory_kb: 6956
final_rank: 9

code_snippet: #include<bits/stdc++.h>
using namespace std;
bool solve(vector<int> v){
    int tal=0;
    for(int i=0;i<v.size();i++){
        if(tal>=i*10){
            tal=max(tal,i*10+v[i]);
        }else return false;
    }
    if(10*(v.size()-1)<=tal)return true;
    else return false;
}
int main(){
    int n;
    cin >> n;
    vector<int> s(n),d;
    for(int i=0;i<n;i++)cin >> s[i];
    d=s;
    reverse(s.begin(),s.end());
    if(solve(d)&&solve(s))cout << "yes" << endl;
    else cout << "no" << endl; 
}
accuracy: 1
time_ms: 50
memory_kb: 7864
final_rank: 11

code_snippet: #include<bits/stdc++.h>
#include <vector>
using namespace std;
int d[300001],wk[300001];
//typedef pair<long long,long long>P;
int main(void)
{
	int n,mx,f;
	cin>>n;
	for(int i=0;i<n;i++) cin>>d[i];
	f=1;
	for(int i=0;i<n;i++) wk[i]=d[i];
	mx=0;
	for(int i=0;i<n-1;i++){
		mx=max(mx,i*10+wk[i]);
		if(mx<(i+1)*10){
			f=0;
			break;
		}
	}
	for(int i=0;i<n;i++) wk[n-i-1]=d[i];
	mx=0;
	for(int i=0;i<n-1;i++){
		mx=max(mx,i*10+wk[i]);
		if(mx<(i+1)*10){
			f=0;
			break;
		}
	}
	if(f==1) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
	return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 5712
final_rank: 6

code_snippet: #include<bits/stdc++.h>
using namespace std;
int d[300000],f[300000];
int main()
{
	int n,i,j=0,flg=0,mx=-1,cnt=-2;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>d[i];
	}
	for(i=0;i<n;i++){
		if(d[i]<10){
			cnt=cnt+10;
		}
		else{
			mx=-1;
			if(mx<d[i]&&d[i]>=20){
				mx=d[i];
				cnt=-2;
			}
		}
		if(cnt>mx){
			flg=1;
			break;
		}
	}
	for(i=n-1;i>=0;i--){
		f[j]=d[i];
		j++;
	}
	mx=-1;
	cnt=-2;
	for(i=0;i<n;i++){
		if(f[i]<10){
			cnt=cnt+10;
		}
		else{
			mx=-1;
			if(mx<f[i]&&f[i]>=20){
				mx=f[i];
				cnt=-2;
			}
		}
		if(cnt>mx){
			flg=1;
			break;
		}
	}
	if(flg==0)	cout<<"yes"<<endl;
	else 	cout<<"no"<<endl;
	return 0;
}
accuracy: 0.25
time_ms: 50
memory_kb: 5712
final_rank: 19

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main()
{
	int i, n, d[1000001], mx=0, flg=0;
	cin >> n;
	for(i=0;i<n;i++) cin >> d[i];
	for(i=0;i<n;i++)
	{
		if(mx < d[i]) mx = d[i];
		if(mx-10 < 0){
			flg = 1;
			break;
		}
		mx -= 10;
	}
	mx = 0;
	for(i=n-1;i>=0;i--)
	{
		if(mx < d[i]) mx = d[i];
		if(mx-10 < 0){
			flg = 1;
			break;
		}
		mx -= 10;
	}
	if(flg == 1) cout << "no" << endl;
	else cout << "yes" << endl;
}
accuracy: 1
time_ms: 50
memory_kb: 6324
final_rank: 8

code_snippet: #ifdef GOHACHI
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
template<class T> using VC = vector<T>;
template<class T,class TT> using P = pair<T,TT>;
template<class T,class TT,class TTT> using TP = tuple<T,TT,TTT>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> using pqR = priority_queue<T>;
#define F first
#define S second
#define INF LLONG_MAX
#define MOD 998244353
ll DX[4] = { 0 , 1 , 0 , -1 };
ll DY[4] = { -1 , 0 , 1 , 0 };
#define st(x,y) sort(x,x+y)
#define stR(x,y) sort(x,x+y,greater<ll>())
#define ST(x) sort(x.begin(),x.end())
#define STR(x) sort(x.rbegin(),x.rend())
#define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define repR(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define rev(x,y) reverse(x,x+y)
#define REV(x) reverse(x.begin(),x.end())
#define dec(x) fixed << setprecision(x)
#define POW(x,y) (ll)pow(x,y)
ll p,f;
void solve() {
	ll n; cin>>n;
	ll d[n];
	rep(i,0,n) cin>>d[i];
	rep(i,0,n-1) { p+=d[i]-10; if (p<0) { f=1; break; } }
	rev(d,n);
	rep(i,0,n-1) { p+=d[i]-10; if (p<0) { f=1; break; } }
	puts( f==0 ? "yes" : "no" );
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int T=1;
    while(T--) solve();
    return 0;
}
accuracy: 0.3
time_ms: 10
memory_kb: 5712
final_rank: 14

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,d[300000],i,flg=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>d[i];
	}
	for(i=0;i<n;i++){
		if(d[i]>=20&&d[i+1]<10){
			i++;
		}
		else if(d[i]<10){
			flg=1;
			break;
		}
	}
	if(flg==0)	cout<<"yes"<<endl;
	else 	cout<<"no"<<endl;
	return 0;
}
accuracy: 0.25
time_ms: 50
memory_kb: 4512
final_rank: 18

code_snippet: #include <bits/stdc++.h>
#define asb(a,b) ((a)-(b)>0?(a)-(b):(b)-(a))
#define atio(v,n) for(int g=0;g<(n);++g)cin >> v[g]
#define atv(v) for(int g=0;g<((v).size());++g)cin >> v[g]
#define atdp(v,en) {int bbbbbb=0;for(auto o:v){if(bbbbbb)cout << en;bbbbbb=1;cout << o;}cout << endl;}
#define atfs(a) printf("%lld %lld\n",(a).first,(a).second)
#define ri(n) rp(i,n)
#define rj(n) rp(j,n)
#define rk(n) rp(k,n)
#define rl(n) rp(l,n)
#define rp(e,c) for(int e=0;e<(c);++e)
#define rix(s,h) rpx(i,s,h)
#define rjx(s,h) rpx(j,s,h)
#define rkx(s,h) rpx(k,s,h)
#define rlx(s,h) rpx(l,s,h)
#define rpx(e,s,h) for(int e=s;e<(h);++e)
#define ci(d,r) ((d)/(r)+(((d)%(r))!=0))
#define pn {pr("No");return 0;}
#define py {pr("Yes");return 0;}
#define pr(a) cout << (a) << endl
#define sbg(a) sort(bgen(a))
#define bgen(a) a.begin(),a.end()
#define INF 114514810
#define LNF 1ll<<60
#define upn(a,b) a=min(a,b)
#define upx(a,b) a=max(a,b)
#define asr(q,n) (0<=(q) && (q)<(n))
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using si=set<int>;
using sll=set<ll>;
using qi=queue<int>;
using qll=queue<ll>;
using qpii=queue<pii>;
using qpll=queue<pll>;
using vst=vector<string>;
using vsi=vector<si>;
using vvi=vector<vi>;
using vvl=vector<vll>;
using tiii=tuple<int,int,int>;
using tlll=tuple<ll,ll,ll>;
using mii=map<int,int>;
using mll=map<ll,ll>;
using stki=stack<int>;
using stkll=stack<ll>;
using tiis=tuple<int,int,string>;
int dx[4]={1,0,-1,0};
int dy[4]={0,-1,0,1};

template <typename T,class Fn>
struct sgt{ // 1-indexed
  vector<T> seg;
  int n;
  T d;
  Fn f;
  sgt(vector<T>& n2,T d,Fn f) : n(n2.size()),d(d), f(f){
    int b=n;
    while(!(b&1))b>>=1;
    if(b!=1){
      int c=0;
      b=n;
      while(b){b>>=1;++c;}
      n=1<<c;
    }
    seg=vector<T>(n<<1,d);
    b=n2.size();
    ri(b)seg[n+i]=n2[i];
    b=n;
    while(b>1){
      for(int i=b/2;i<b;++i)seg[i]=f(seg[2*i],seg[2*i+1]);
      b/=2;
    }
	return;
  }
  void update(int pos,T val){
    int i=n+pos;
    seg[i]=val;
    while(i/=2)seg[i]=f(seg[2*i],seg[2*i+1]);
	return;
  }
  T get(int l,int r){
    T tmp=d;
    int p=l;
    int c=0;
    while((p+(1<<c))<=r){
      if(p&(1<<c)){
        tmp=f(tmp,seg[(p>>c)+(n>>c)]);
        p+=1<<c;
      }
      ++c;
    }
    --c;
    while(p<r){
      if((r-p)&(1<<c)){
        tmp=f(tmp,seg[(p>>c)+(n>>c)]);
        p+=(1<<c);
      }
      --c;
    }
    return tmp;
  }
  T get(int pos){
    return seg[n+pos];
  }
};

int ad(int a,int b){return a+b;}

int main(){
  int n;
  cin >> n;
  vi d(n),enb(n+1),reb(n+1);
  sgt en(enb,0,ad),re(reb,0,ad);
  en.update(0,1);
  en.update(1,-1);
  re.update(0,1);
  re.update(1,-1);
  atv(d);
  ri(n-1){
    if(!en.get(0,i+1))continue;
    int t=min(n,i+1+d[i]/10);
    en.update(i,en.get(i)+1);
    en.update(t,en.get(t)-1);
  }
  ri(n-1){
    if(!re.get(0,i+1))continue;
    int t=min(n,i+1+d[n-1-i]/10);
    re.update(i,re.get(i)+1);
    re.update(t,re.get(t)-1);
  }
  // ri(n+1)pr(en.get(i));
  // ri(n+1)pr(re.get(i));
  if(en.get(0,n)!=0 && re.get(0,n)!=0)pr("yes");else pr("no");
}
accuracy: 1
time_ms: 110
memory_kb: 14828
final_rank: 13

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

int n;
vector<int> d;
bool jump_go(int location) {
    if(location >= n)   location = n;
    if (location >= d.size() - 1) {
        return true;
    }
    if(d[location] / 10 == 0){
        return false;
    }
    for (int i = 1; i <= d[location] / 10; i++) {
        if(jump_go(location + i))   return true;
    }
    return false;
}

bool jump_back(int location) {
    if(location < 0)   location = 0;
    if (location <= 0) {
        return true;
    }
    if(d[location] / 10 == 0){
        return false;
    }
    for (int i = 1; i <= d[location] / 10; i++) {
        if(jump_go(location - i))   return true;
    }
    return false;
}

int main() {
    cin >> n;
    int karivalue;
    for (int i = 0; i < n; i++){
        cin >> karivalue;
        d.push_back(karivalue);
    } 

    int location = 0;
    if (!jump_go(location)) {
        cout << "no" << endl;
        return 0;
    }

    location = n - 1;
    if(!jump_back(location)){
        cout << "no" << endl;
        return 0;
    }

    cout << "yes" << endl;

    return 0;
}
accuracy: 0.275
time_ms: 40
memory_kb: 14032
final_rank: 16

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

int n;
vector<int> d;
bool jump_go(int location) {
    if(location >= n)   location = n;
    if (location >= d.size()) {
        return true;
    }
    if(d[location] / 10 == 0){
        return false;
    }
    for (int i = 1; i <= d[location] / 10; i++) {
        if(jump_go(location + i))   return true;
    }
    return false;
}

bool jump_back(int location) {
    if(location < 0)   location = 0;
    if (location <= 0) {
        return true;
    }
    if(d[location] / 10 == 0){
        return false;
    }
    for (int i = 1; i <= d[location] / 10; i++) {
        if(jump_go(location - i))   return true;
    }
    return false;
}

int main() {
    cin >> n;
    int karivalue;
    for (int i = 0; i < n; i++){
        cin >> karivalue;
        d.push_back(karivalue);
    } 

    int location = 0;
    if (!jump_go(location)) {
        cout << "no" << endl;
        return 0;
    }

    location = n - 1;
    if(!jump_back(location)){
        cout << "no" << endl;
        return 0;
    }

    cout << "yes" << endl;

    return 0;
}
accuracy: 0.275
time_ms: 40
memory_kb: 14928
final_rank: 17

code_snippet: #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rp(e,c) for(int e=0;e<c;e++)
#define vec(i) vector<i>
#define ri(n) rp(i, n)
#define rj(n) rp(j, n)
#define rk(n) rp(k, n)
#define all(a) a.begin(),a.end()
#define mkp(a,b) make_pair(a, b)
#define st(a) sort(all(a))
#define rst(a) sort(a.rbegin(), a.rend())
#define si(a) a.size()
#define fi first
#define se second
#define str string
#define el endl
#define Graph vector<vector<int>>
#define Glit vector<str>
#define pr(a) cout << a << el
#define tpr(a, b) cout << a << ' ' << b << el
#define in(a) cin >> a
#define twin(a, b) cin >> a >> b
#define trin(a, b, c) cin >> a >> b >> c
#define fin(a, b, c, d) cin >> a >> b >> c >> d

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using msi = map<str, int>;
using mci = map<char, int>;
using qll = queue<ll>;
using BFS_list = queue<ll>;
using DFS_list = stack<ll>;
using sei = set<int>;
using sell = set<ll>;
using dei = deque<int>;

bool prime_judge(int n){
    if (n == 1){
        return false;
    }
    for(int i = 2; i * i <= n;i++){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}

int kai(int n){
    int num_ = 1;
    for(int i = 1;i <= n;i++){
        num_ *= i;
    }
    return num_;
}

ll max_keta(ll n, ll a){
    int cnt = 0;
    while(n != 0){
        cnt++;
        n /= a;
    }
    return cnt;
}

string to16_from10(int x, int size = 0) {
    char hex_buf[16];
    sprintf(hex_buf, "%X", x);
    string hex_str = hex_buf;
    if (size == 0) {
        return hex_str;
    }
    string front;
    if (x >= 0) front = "0";
    else front = "F";
    int diff = size - hex_str.length();
    for (int i=0; i < diff; i++){
        hex_str = front + hex_str;
    }
    if (diff < 0) {
        hex_str.erase(0, -diff);
    }
    return hex_str;
}

pii pi_sa(pii a, pii b){
    pii sa = mkp(a.fi - b.fi, a.se - b.se);
    return sa;
}

pii pi_wa(pii a, pii b){
    pii wa = mkp(a.fi + b.fi, a.se + b.se);
    return wa;
}

int max_devid(int n, int a){
    if (n % a != 0){
        return 0;
    }
    int cnt = 0;
    while(n != 1){
        cnt++;
        n /= a;
    }
    return cnt;
}

#define plase(cnt, a) cnt[a.fi][a.se]

int h_n(char hou){
    if (hou == 'U'){
        return 0;
    }else if(hou == 'D'){
        return 2;
    }else if(hou == 'L'){
        return 3;
    }else{
        return 1;
    }
}

pii shi(pii now, int hou){
    switch (hou % 4) {//0:上 1:右 2:下 3:左
        case 0:{
            now.fi--;
            break;
        }
        case 1:{
            now.se++;
            break;
        }
        case 2:{
            now.fi++;
            break;
        }
        case 3:{
            now.se--;
            break;
        }
    }
    return now;
}

#define MOD_INF 998244353

bool check(ll n){
    ll kura = -1;
    while(n != 0){
        if (kura >= n % 10){
            return false;
        }else{
            kura = n % 10;
            n /= 10;
        }
    }
    return true;
}

bool big_pair_small(pii a, pii b){
    if (a.fi >= b.fi && a.se >= b.se){
        return true;
    }
    return false;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    // 答えを表す可変長配列
    vector<pair<long long, long long> > res;

    // √N まで試し割っていく
    for (long long p = 2; p * p <= N; ++p) {
        // N が p で割り切れないならばスキップ
        if (N % p != 0) {
            continue;
        }

        // N の素因数 p に対する指数を求める
        int e = 0;
        while (N % p == 0) {
            // 指数を 1 増やす
            ++e;

            // N を p で割る
            N /= p;
        }

        // 答えに追加
        res.emplace_back(p, e);
    }

    // 素数が最後に残ることがありうる
    if (N != 1) {
        res.emplace_back(N, 1);
    }
    return res;
}

#include <cmath>


int main(void) {
    int n;
    cin >> n;
    vec(int) d(n);
    ri(n){
        cin >> d[i];
        d[i] /= 10;
    }

    vec(int) kyo(n, 0);
    ri(n - 1){
        kyo[i + 1] = max(kyo[i] - 1, d[i]);
        //     cout << kyo[i + 1] << endl;
        if (kyo[i + 1] == 0){
            cout << "no" << endl;
            return 0;
        }
    }
    //cout << "-----" << endl;
    reverse(all(d));
    vec(int) kyo2(n + 1, 0);
    ri(n - 1){
        kyo[i + 1] = max(kyo[i] - 1, d[i]);
    //        cout << kyo[i + 1] << endl;
        if (kyo[i + 1] == 0){
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
}
accuracy: 1
time_ms: 60
memory_kb: 6552
final_rank: 10

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(T) T.begin(), T.end()
using ll = long long;
using P = pair<int, int>;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

ll n;
vector<ll> d;
bool chk() {
    vector<bool> can(n);
    can[0] = true;
    ll mx=0;
    rep(i, n - 1) {
        if(mx>=i)mx=max(mx,(ll)i+d[i]);
    }
    if (mx>=n-1)
        return true;
    else
        return false;
}

int main() {
    cin >> n;
    d.resize(n);
    rep(i, n) cin >> d[i];
    rep(i, n) d[i] /= 10;
    if (chk()) {
        reverse(all(d));
        if (chk()) {
            cout << "yes" << endl;
        } else
            cout << "no" << endl;
    } else
        cout << "no" << endl;
}
accuracy: 1
time_ms: 50
memory_kb: 5452
final_rank: 5

code_snippet: #include <bits/stdc++.h>
using namespace std;
long long int a = 0, b = 0, c = 0, d = 0, e = 0, sum = 0, ans = 0, num = 0, counter = 0;
string sa, sb, sc, sd, se, sans;
char cha, chb, chc, chd, che;
using vll = vector<long long>;
using vst = vector<string>;
using ll = long long;
using pll = pair<int64_t, int64_t>;
#define pa(types) {pair<types, types>}
#define pb(type_a, type_b) {pair<type_a, type_b>}
#define rep2(variable2, start2, end2) for (long long variable2 = (start2); variable2 < (end2); variable2++)
#define rep(variable, end) rep2(variable, 0, end)
#define in(nyuuryoku) cin >> (nyuuryoku);
#define out(nuu)                  \
    {                             \
        auto qwertyui = (nuu);    \
        cout << qwertyui << "\n"; \
    }

ll GCDr(ll a, ll b) {
    // b min
    if (b == 0) {
        return a;
    }
    return GCDr(b, a % b);
}
ll GCD(ll a, ll b) {
    // b min
    while (b != 0) {
        ll t = a % b;
        a = b;
        b = t;
    }
    return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
int main() {
    in(a)vll dist(a), able_go(a), able_back(a);
    rep(i, a){in(dist[i])} ll able_reach_last = 0, able_reach_begin = 0;
    able_go[0] = 1;
    able_back[a - 1] = 1;

    // rep(i, a) {
    //     d = dist[i];
    //     if (able_go[i] == 1) {
    //         rep(j, d / 10) {
    //             if (i + j + 1 < a) able_go[i + j + 1] = 1;
    //         }
    //     }
    // }
    // for (ll i = a - 1; i >= 0; i--) {
    //     d = dist[i];
    //     if (able_back[i]) {
    //         rep(j, d / 10) {
    //             if (i - j - 1 >= 0) able_back[i - j - 1] = 1;
    //         }
    //     }
    // }
    // if (able_go[a - 1] == 1 && able_back[0] == 1) out("yes") else out("no")
    able_reach_last = 0;
    able_reach_begin = a - 1;

    // go
    rep(i, a) {
        d = dist[i];
        if (i <= able_reach_last) {
            // able_reach_last = able_reach_last + d / 10;
            able_reach_last = max(able_reach_last, (i + d / 10));
        }
    }

    // back
    for (ll i = a - 1; i >= 0; i--) {
        d = dist[i];
        if (able_reach_begin <= i) {
            // able_reach_begin = able_reach_begin - d / 10;
            able_reach_begin = min(able_reach_begin, (i - d / 10));
        }
    }
    // if (able_go[a - 1] == 1 && able_back[0] == 1) out("yes") else out
    if (able_reach_last >= a - 1 && able_reach_begin <= 0) out("yes") else out("no")

    // out(able_reach_last) out(able_reach_begin)
}
accuracy: 1
time_ms: 40
memory_kb: 10356
final_rank: 12

code_snippet: #include <bits/stdc++.h>
using namespace std;
long long int a = 0, b = 0, c = 0, d = 0, e = 0, sum = 0, ans = 0, num = 0, counter = 0;
string sa, sb, sc, sd, se, sans;
char cha, chb, chc, chd, che;
using vll = vector<long long>;
using vst = vector<string>;
using ll = long long;
using pll = pair<int64_t, int64_t>;
#define pa(types) {pair<types, types>}
#define pb(type_a, type_b) {pair<type_a, type_b>}
#define rep2(variable2, start2, end2) for (long long variable2 = (start2); variable2 < (end2); variable2++)
#define rep(variable, end) rep2(variable, 0, end)
#define in(nyuuryoku) cin >> (nyuuryoku);
#define out(nuu)                  \
    {                             \
        auto qwertyui = (nuu);    \
        cout << qwertyui << "\n"; \
    }

ll GCDr(ll a, ll b) {
    // b min
    if (b == 0) {
        return a;
    }
    return GCDr(b, a % b);
}
ll GCD(ll a, ll b) {
    // b min
    while (b != 0) {
        ll t = a % b;
        a = b;
        b = t;
    }
    return a;
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
int main() {
    in(a)vll dist(a), able_go(a), able_back(a);
    rep(i, a){in(dist[i])} ll able_reach_last = 0, able_reach_begin = 0;
    able_go[0] = 1;
    able_back[a - 1] = 1;

    // rep(i, a) {
    //     d = dist[i];
    //     if (able_go[i] == 1) {
    //         rep(j, d / 10) {
    //             if (i + j + 1 < a) able_go[i + j + 1] = 1;
    //         }
    //     }
    // }
    // for (ll i = a - 1; i >= 0; i--) {
    //     d = dist[i];
    //     if (able_back[i]) {
    //         rep(j, d / 10) {
    //             if (i - j - 1 >= 0) able_back[i - j - 1] = 1;
    //         }
    //     }
    // }
    // if (able_go[a - 1] == 1 && able_back[0] == 1) out("yes") else out("no")
    able_reach_last = 0;
    able_reach_begin = a - 1;

    // go
    rep(i, a) {
        d = dist[i];
        if (i <= able_reach_last) {
            able_reach_last = able_reach_last + d / 10;
        }
    }

    // back
    for (ll i = a - 1; i >= 0; i--) {
        d = dist[i];
        if (able_reach_begin <= i) {
            able_reach_begin = able_reach_begin - d / 10;
        }
    }
    // if (able_go[a - 1] == 1 && able_back[0] == 1) out("yes") else out
    if (able_reach_last >= a - 1 && able_reach_begin <= 0) out("yes") else out("no")
}
accuracy: 0.3
time_ms: 40
memory_kb: 10356
final_rank: 15