Submission #108060

#TimeUsernameProblemLanguageResultExecution timeMemory
108060autumn_eelPalembang Bridges (APIO15_bridge)C++14
0 / 100
4 ms412 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef pair<int,int>P; typedef long long ll; int n,a,b; int d[3000]; bool dp[200][200]; void solve1(){ ll ans=0; for(int i=39;i>=0;i--){ memset(dp,0,sizeof(dp)); dp[0][0]=true; rep(j,n)rep(k,n){ if(!dp[j][k])continue; ll sum=0; for(int t=j;t<n;t++){ sum+=d[t]; if(((sum&~((1LL<<i)-1))|ans)==ans){ dp[t+1][k+1]=true; } } } bool ok=false; for(int j=a;j<=b;j++){ if(dp[n][j])ok=true; } if(!ok)ans+=(1LL<<i); } cout<<ans<<endl; } void solve2(){ } int main(){ cin>>n>>a>>b; rep(i,n){ scanf("%d",&d[i]); } if(n<=100){ solve1(); } else{ } }

Compilation message (stderr)

bridge.cpp: In function 'int main()':
bridge.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&d[i]);
   ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...