제출 #1279004

#제출 시각아이디문제언어결과실행 시간메모리
1279004lmquan은행 (IZhO14_bank)C++20
100 / 100
96 ms8652 KiB
#define taskname "" #include <bits/stdc++.h> using namespace std; int main() { if (fopen(taskname".inp", "r")) { freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } vector<int> x(1 << m, -1), y(1 << m, -1); x[0] = y[0] = 0; for (int i = 1; i < (1 << m); i++) { for (int j = 0; j < m; j++) { if ((i >> j & 1) && x[i ^ (1 << j)] != -1) { int u = y[i ^ (1 << j)] + b[j], v = a[x[i ^ (1 << j)]]; if (u == v) { x[i] = x[i ^ (1 << j)] + 1, y[i] = 0; } else if (u < v) { x[i] = x[i ^ (1 << j)], y[i] = u; } } } if (x[i] == n) { cout << "YES"; return 0; } } cout << "NO"; return 0; }

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

bank.cpp: In function 'int main()':
bank.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen(taskname".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen(taskname".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...