Submission #1006583

# Submission time Handle Problem Language Result Execution time Memory
1006583 2024-06-24T04:08:08 Z andecaandeci Collecting Mushrooms (NOI18_collectmushrooms) C++17
0 / 100
2 ms 4184 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define repp(i,x,n) for(int i=x;i<=n;i++)
#define repo(i,x,n) for(int i=x;i>=n;i--)
#define cy cout<<"Yes"<<endl
#define cn cout<<"No"<<endl
#define r0 return 0
#define fi first
#define se second
#define liow ios_base::sync_with_stdio(false);cin.tie(NULL)
#define jelek cout<<"jelek"<<endl
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define pi pair<pair<int,int>,pair<int,int>>
#define p4 pair<pii,pii>
#define fl fflush(stdout)
using namespace std;
const int mod=1e9+7,maxn=1e6+5,N=(1<<17),INF=1e18;
int dp[500005];
void solve(){
  int n;cin>>n;
  repp(i,1,n){
    int x;cin>>x;
    for(int j=x;j>=2;j--){
      if(j+2<=500005) dp[j]=dp[j+2]+1;
      if(j+3<=500005) dp[j]=max(dp[j],dp[j+3]+1);
    }
  }
  cout<<dp[1];
}

signed main() {
    liow;
    int t=1;
//  cin>>t;
    while(t--){
      solve();
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -