제출 #438443

#제출 시각아이디문제언어결과실행 시간메모리
438443KazamaHoang은행 (IZhO14_bank)C++14
25 / 100
1094 ms300 KiB
/* -> Written by <- ----------- |K_A_Z_A_M_A| |___________| | ___ | | (^_^) | | /( | )\ | |____|_|____| H O A N G */ #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; using ll = long long; using db = long double; //using int = long long #define Task "" #define F first #define S second #define eb emplace_back #define sz(x) ((int)x.size()) #define all(x) x.begin(), x.end() #define sall(x, n) x.begin() + 1, x.end() + 1 + n #define bit(x, i) (((x) >> (i)) & 1) #define endl '\n' #define fr(i,a,b) for (int i = (int)(a); i <= (int)(b); ++ i) #define FR(i,a,b) for (int i = (int)(a); i < (int)(b); ++ i) #define frr(i,a,b) for (int i = (int)(a); i >= (int)(b); -- i) #define fre(i, a) for (auto &i : a) // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifndef ONLINE_JUDGE #define debug(x...) {cerr << "[" << #x << "] = ["; _print(x); } #else #define debug(x...) #endif const int MOD = 1e9 + 7; const ll MM = (ll)MOD * MOD; const int base = 1e6; const int B = 32; const int inf = 1e9 + 7; const ll INF = 1e18 + 7; const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; const int dy8[] = {1, -1, 0, 1, -1, 0, 1, -1}; const int dx4[] = {0, 0, 1, -1}; const int dy4[] = {1, -1, 0, 0}; // code go here int n, m; int a[25], b[25], id[25]; void solve(int tc) { cin >> n >> m; fr(i, 1, n) cin >> a[i]; fr(i, 1, m) cin >> b[i], id[i] = i; do { int s = 0, x = 1; fr(i, 1, m) { int u = id[i]; s += b[u]; if (x <= n && s == a[x]) ++ x, s = 0; } if (x == n + 1) { cout << "YES\n"; return; } } while (next_permutation(id + 1, id + 1 + m)); cout << "NO\n"; } signed main(){ cin.tie(0)->sync_with_stdio(0); if (fopen(".in", "r")) { freopen(".in", "r", stdin); freopen(".out", "w", stdout); freopen(".log", "w", stderr); } else if (fopen(Task".in", "r")) { freopen(Task".in", "r", stdin); freopen(Task".out", "w", stdout); } int test_case = 1; // cin >> test_case; // prepare(); fr(i, 1, test_case) { solve(i); // bf(); } return 0; } // try your best !!!

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

bank.cpp: In function 'int main()':
bank.cpp:103:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  103 |         freopen(".in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~
bank.cpp:104:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  104 |         freopen(".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
bank.cpp:105:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  105 |         freopen(".log", "w", stderr);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
bank.cpp:108:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  108 |         freopen(Task".in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:109:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  109 |         freopen(Task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...