제출 #855105

#제출 시각아이디문제언어결과실행 시간메모리
855105bestrazhuxp은행 (IZhO14_bank)C++17
44 / 100
649 ms262144 KiB
#include <bits/stdc++.h> #define ll long long #define se second #define fi first #define pb push_back #define all(x) (x).begin() , (x).end() #define sz(x) (int)(x).size() #define BIT(x , i) ((x) >> (i) & 1) #define MASK(i) (1LL << (i)) #define name "1" #define task "" using namespace std; const int inf = 1e9 + 7; const ll linf = 1ll * inf * inf; const int mod = 1e9 + 7; const int maxn = 1e5 + 2; vector <int> f[1 << 20]; int a[20]; int b[20]; vector <int> s[20 * 1000 + 1]; void file(){if(fopen(task".inp" , "r")){freopen(task".inp" , "r" , stdin);freopen(task".out" , "w" , stdout);}else if(fopen(name".inp" , "r")){freopen(name".inp" , "r" , stdin);freopen(name".out" , "w" , stdout);}} int n , m; int main() { file(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0 ; i < m; i++) cin >> b[i]; for(int i = 0 ; i < MASK(m) ; i++) { int sum = 0; for(int j = 0 ; j < m ; j++) if(BIT(i , j)) sum += b[j]; s[sum].pb(i); } f[0].pb(0); for(int mask = 1; mask < MASK(n) ; mask++) { for(int j = 0 ; j < n; j++) { if(BIT(mask , j)) { int prev = mask ^ MASK(j); for(auto x : f[prev]) { for(auto y : s[a[j]]) { if(!(x & y)) { f[mask].pb(x ^ y); } } } } } } if(sz(f[MASK(n) - 1]) == 0) return cout << "NO" , 0; cout << "YES"; }

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

bank.cpp: In function 'void file()':
bank.cpp:23:48: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | void file(){if(fopen(task".inp" , "r")){freopen(task".inp" , "r" , stdin);freopen(task".out" , "w" , stdout);}else if(fopen(name".inp" , "r")){freopen(name".inp" , "r" , stdin);freopen(name".out" , "w" , stdout);}}
      |                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:23:82: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | void file(){if(fopen(task".inp" , "r")){freopen(task".inp" , "r" , stdin);freopen(task".out" , "w" , stdout);}else if(fopen(name".inp" , "r")){freopen(name".inp" , "r" , stdin);freopen(name".out" , "w" , stdout);}}
      |                                                                           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:23:151: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | void file(){if(fopen(task".inp" , "r")){freopen(task".inp" , "r" , stdin);freopen(task".out" , "w" , stdout);}else if(fopen(name".inp" , "r")){freopen(name".inp" , "r" , stdin);freopen(name".out" , "w" , stdout);}}
      |                                                                                                                                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:23:185: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | void file(){if(fopen(task".inp" , "r")){freopen(task".inp" , "r" , stdin);freopen(task".out" , "w" , stdout);}else if(fopen(name".inp" , "r")){freopen(name".inp" , "r" , stdin);freopen(name".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...