제출 #1008675

#제출 시각아이디문제언어결과실행 시간메모리
1008675detective_dots은행 (IZhO14_bank)C++17
0 / 100
100 ms59472 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(); }freopen("bank.out", "w", stdout); freopen("bank.in", "r", stdin); 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"; }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'int main(int, char**)':
bank.cpp:83:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |         freopen("out.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:84:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   84 |         freopen("in.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
bank.cpp:86:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   86 |     }freopen("bank.out", "w", stdout);
      |      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:87:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   87 |         freopen("bank.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...