Submission #854830

#TimeUsernameProblemLanguageResultExecution timeMemory
854830hungt58Bank (IZhO14_bank)C++14
71 / 100
1086 ms448 KiB
#pragma GCC optimize(" unroll-loops") #pragma gcc optimize("Ofast") #pragma GCC optimization("Ofast") #pragma optimize(Ofast) #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll int #define TIME (1.0 * clock() / CLOCKS_PER_SEC) ll n,m,a[21],b[21],res; void dao(ll i) { for (ll j=1;j<=n;j++) if (a[j]>=b[i]) { a[j]-=b[i]; if (a[j]==0) res--; if (m-i>=res) { if (i==m) {if (res==0){cout<<"YES";exit(0);}} else dao(i+1); } if (a[j]==0) res++; a[j]+=b[i]; } } int main() { ios_base :: sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n>>m; for (ll i=1;i<=n;i++) cin>>a[i]; n++; a[n]=100010; for (ll i=1;i<=m;i++) cin>>b[i]; res=n-1; dao(1); cout<<"NO"; }

Compilation message (stderr)

bank.cpp:2: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    2 | #pragma gcc optimize("Ofast")
      | 
bank.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization("Ofast")
      | 
bank.cpp:4: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    4 | #pragma optimize(Ofast)
      | 
bank.cpp:1:37: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize(" unroll-loops")
      |                                     ^
bank.cpp:14:15: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
   14 |  void dao(ll i)
      |               ^
bank.cpp:31:10: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
   31 | int main()
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...