Submission #1008670

#TimeUsernameProblemLanguageResultExecution timeMemory
1008670detective_dotsBank (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <random> using namespace __gnu_pbds; using namespace std; #define sp << ' ' #define ll long long #define ull unsigned long long #define endl '\n' #define MOD 1000000007ll #define b_rev boost::adaptors::reverse typedef vector<int> vi; typedef vector<ll> vll; typedef array<int, 2> ii; typedef vector<array<int, 2>> vii; #define vv(type) vector<vector<type>> #define F first #define S second #define PB push_back #define REP(i, a, b) for (int i = a; i < b; i++) #define elif else if #define nl <<'\n' #define out(txt) {cout << txt << '\n'; return;} template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using multi_ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T> using min_queue = priority_queue<T, vector<T>, greater<>>; // Pair addition template<typename T, typename U, typename V, typename W> auto operator+(const std::pair<T, U> &l, const std::pair<V, W> &r) -> std::pair<decltype(l.first + r.first), decltype(l.second + r.second)> { return {l.first + r.first, l.second + r.second}; } template<typename T> T getValue() { T value; std::cin >> value; return value; } void printVec(vector<int> v) { for (const auto &i: v) { cout << i sp; } cout nl; } void printVec(vector<ll> v) { for (const auto &i: v) { cout << i sp; } cout nl; } void printVec(vector<vi> v) { for (const auto &item: v)printVec(item); } void printVec(vector<vector<ll>> v) { for (const auto &item: v)printVec(item); } void printPair(pair<ll, ll> x) { cout << x.first sp << x.second nl; } ll lcm(ll a, ll b) { return (a / __gcd(a, b)) * b; } short int sign(ll x) { if (x < 0) return -1; else if (x > 0) return 1; else return 0; } double START_TIME; void solve(); void precompute(); int main(int argc, char *argv[]) { if (argc > 1 && argv[1][0] - '0') { #freopen("out.txt", "w", stdout); #freopen("in.txt", "r", stdin); #START_TIME = clock(); } ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; // precompute(); // cin >> t; for (int i = 0; i < t; ++i) { // cout << "Case #" << i + 1 << ": "; solve(); } if (argc > 1 && argv[1][0] - '0') { double END_TIME = clock(); double TIME_TAKEN = double(END_TIME - START_TIME) / double(CLOCKS_PER_SEC); #cout << "\n// Time taken = " << fixed << std::setprecision(5) << TIME_TAKEN << " ms\n"; } } void solve() { ll n, m; cin >> n >> m; vi a(n), b(m); for (int i = 0; i < n; ++i)cin>>a[i]; for (int i = 0; i < m; ++i)cin >> b[i]; do { vi pre(m + 1); for (int i = 0; i < m; ++i) { pre[i + 1] = pre[i] + b[i]; } int l = 0; int p = 0; for (int i = 0; i <= m; ++i) { if (pre[i] - pre[l] > a[p]){ break; } else if (pre[i] - pre[l] == a[p]){ p++; l = i; if (p == n){ cout << "YES\n"; return; } } } } while (next_permutation(b.begin(), b.end())); cout << "NO\n"; }

Compilation message (stderr)

bank.cpp:83:10: error: invalid preprocessing directive #freopen
   83 |         #freopen("out.txt", "w", stdout);
      |          ^~~~~~~
bank.cpp:84:10: error: invalid preprocessing directive #freopen
   84 |         #freopen("in.txt", "r", stdin);
      |          ^~~~~~~
bank.cpp:85:10: error: invalid preprocessing directive #START_TIME
   85 |         #START_TIME = clock();
      |          ^~~~~~~~~~
bank.cpp:100:10: error: invalid preprocessing directive #cout
  100 |         #cout << "\n// Time taken = " << fixed << std::setprecision(5) << TIME_TAKEN << " ms\n";
      |          ^~~~
bank.cpp: In function 'int main(int, char**)':
bank.cpp:99:16: warning: unused variable 'TIME_TAKEN' [-Wunused-variable]
   99 |         double TIME_TAKEN = double(END_TIME - START_TIME) / double(CLOCKS_PER_SEC);
      |                ^~~~~~~~~~