이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double
#define fr(i,n) for(i=0;i<n;i++)
#define fa(i,v) for(auto &i:v)
#define yesno cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define vvl vector<vector<ll> >
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define vvpll vector<vector<pair<ll,ll> > >
#define mp make_pair
#define pb push_back
#define rs resize
#define cl(v) v.clear()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define inf (ll)1e18
#define f1 first
#define f2 second
#define mod (ll)(1e9+7)
int main(){
fastio
ll n,m,i,j;
cin>>n>>m;
ll a[n], b[m];
fr(i,n) cin>>a[i];
fr(i,m) cin>>b[i];
vpll dp(1<<m); //leftover, peple cov
dp[0]=mp(0,0);
fr(i,(1<<m)) if(i){
fr(j,m){
if(dp[(1<<j)^i].f1+b[j]==a[dp[(1<<j)^i].f2+1] && dp[i].f2<dp[(1<<j)^i].f2+1){
dp[i].f2=dp[(1<<j)^i].f2+1;
dp[i].f1=0;
}
else if(dp[(1<<j)^i].f1+b[j]<a[dp[(1<<j)^i].f2+1] && dp[i].f2<dp[(1<<j)^i].f2){
dp[i].f2=dp[(1<<j)^i].f2;
dp[i].f1=a[dp[(1<<j)^i].f2+1]-dp[(1<<j)^i].f1+b[j];
}
}
if(dp[i].f2==n-1) break;
}
if(i!=(1<<m)) yesno
}
컴파일 시 표준 에러 (stderr) 메시지
bank.cpp: In function 'int main()':
bank.cpp:8:15: warning: macro expands to multiple statements [-Wmultistatement-macros]
8 | #define yesno cout<<"YES"<<endl; else cout<<"NO"<<endl;
| ^~~~
bank.cpp:46:19: note: in expansion of macro 'yesno'
46 | if(i!=(1<<m)) yesno
| ^~~~~
bank.cpp:46:5: note: some parts of macro expansion are not guarded by this 'if' clause
46 | if(i!=(1<<m)) yesno
| ^~
# | 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... |