제출 #90057

#제출 시각아이디문제언어결과실행 시간메모리
90057Rashidov_Anis은행 (IZhO14_bank)C++14
0 / 100
4 ms628 KiB
#include <bits/stdc++.h> #define fr first #define se second #define sc scanf #define pf printf #define ld long double #define ll long long #define pb push_back #define sq(n) n * n #define r_0 return 0 #define pr pair < ll, ll > #define prr pair < pair < ll, ll >, ll > #define fin(s) freopen( s, "r", stdin ) #define fout(s) freopen( s, "w", stdout ) #define TIME ios_base::sync_with_stdio(0) using namespace std; const ll INF = 1e9; const ll N = 2e3 + 3; const ll mod = 998244353; const ld eps = 1e-7; ll n, m; ll ans; ll b[N], a[N]; vector < ll > v[N]; main(){ TIME; fin( "bank.in" ); fout( "bank.out" ); cin >> n >> m; for( int i = 1; i <= n; i ++ ){ cin >> a[i]; } for( int i = 1; i <= m; i ++ )cin >> b[i]; for( int i = 0; i <= ( 1 << m + 1 ); i ++ ){ ans = 0; vector < ll > g; for( int j = 0; j < m; j ++ ){ ll k = ( i >> j ) & 1; if( k == 1 )ans += b[j + 1], g.pb( j + 1 ); } if( ans <= N - 2 && v[ans].empty() )v[ans] = g; //cout << i << ' ' << ans << '\n'; } for( int i = 1; i <= n; i ++ ){ //cout << "=> " << a[i] << " "; if( v[a[i]].empty() ){ cout << "NO"; r_0; } for( auto u: v[a[i]] ){ //cout << u << ' '; if( !b[u] ){ cout << "NO"; r_0; } b[u] = 0; } //cout << endl; } cout << "YES"; }

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

bank.cpp:28:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
bank.cpp: In function 'int main()':
bank.cpp:37:35: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     for( int i = 0; i <= ( 1 << m + 1 ); i ++ ){
                                 ~~^~~
bank.cpp:13:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 #define fin(s) freopen( s, "r", stdin )
                ~~~~~~~^~~~~~~~~~~~~~~~~
bank.cpp:30:5: note: in expansion of macro 'fin'
     fin( "bank.in" );
     ^~~
bank.cpp:14:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 #define fout(s) freopen( s, "w", stdout )
                 ~~~~~~~^~~~~~~~~~~~~~~~~~
bank.cpp:31:5: note: in expansion of macro 'fout'
     fout( "bank.out" );
     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...