Submission #765576

#TimeUsernameProblemLanguageResultExecution timeMemory
765576LeaRouseCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0); cin.tie(0); #define ll long long #define ff first #define ss second using namespace std; const int MAX = 25; int A[MAX],B[MAX]; pair<int,int>dp[(1<<21)+5]; void go(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++) cin>>A[i]; for(int i=1;i<=m;i++) cin>>B[i]; for(int i=0;(i<<m);i++){ dp[i]={-1,-1}; } bool ans=false; dp[0]={1,0}; for(int i=0;i<(1<<m);i++){ int mask=i; for(int j=1;j<=m;j++){ if( (mask&( 1<< (j-1) )) ){ int ant=mask ^ (1<<(j-1)); if(dp[ant].ff==-1) continue; int a=dp[ant].ss+B[j]; int b=A[dp[ant].ff]; if(a<b){ if(dp[ant].ff>dp[mask].ff) dp[mask]={dp[ant].ff,a}; } else if(a==b){ if(dp[ant].ff+1>dp[mask].ff) dp[mask]={dp[ant].ff+1,0}; } } } if(dp[mask].ff==n+1) ans=true; } if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl; } int main(){ fastio; go(); return 0; }

Compilation message (stderr)

combo.cpp: In function 'void go()':
combo.cpp:14:19: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
   14 |     for(int i=0;(i<<m);i++){
      |                 ~~^~~~
/usr/bin/ld: /tmp/cclWgFFZ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccuEfSvZ.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cclWgFFZ.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status