Submission #1215153

#TimeUsernameProblemLanguageResultExecution timeMemory
1215153sakuraBank (IZhO14_bank)C++20
25 / 100
1095 ms328 KiB
// #define ONLINE_JUDGE #include "bits/stdc++.h" using namespace std; #if __has_include("cleanup/debug.h") && (!defined(ONLINE_JUDGE)) #include "cleanup/debug.h" #else #pragma message("debug.h not found, or ONLINE_JUDGE defined.") #define print(...) ((void)0) #define printarr(...) ((void)0) #endif using ll = long long; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define kill(x) return void(cout << (x)); #define each(x, v) for (auto &x : (v)) template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;} template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;} template<class T> void getv(T& v) {each(i, v)cin>>i;} mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> T rnglr(T l, T r) {return uniform_int_distribution<T>(l, r)(rng);} void solve(); int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); // freopen("area.in", "r", stdin); int tt = 1; // cin >> tt; while(tt--) { solve(); if(tt) cout << '\n'; }return 0; } void solve() { int n, m, t; cin >> n >> m; int po[n], ba[m]; for (int i = 0; i < n; i++) cin >> po[i]; for (int i = 0; i < m; i++) cin >> ba[i]; sort(ba, ba+m); do { int sum = 0, ptr = 0; for (int i = 0; i < m; i++) { sum += ba[i]; if (sum == po[ptr]) ptr++, sum = 0; } if (ptr == n) { kill("YES"); } } while(next_permutation(ba, ba+m)); cout << "NO"; }

Compilation message (stderr)

bank.cpp:7:66: note: '#pragma message: debug.h not found, or ONLINE_JUDGE defined.'
    7 |     #pragma message("debug.h not found, or ONLINE_JUDGE defined.")
      |                                                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...