제출 #892450

#제출 시각아이디문제언어결과실행 시간메모리
892450I_FloPPed21은행 (IZhO14_bank)C++14
71 / 100
602 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") int n, m ; int v[ 22 ], b [ 22 ] ; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m ; for ( int i = 1; i <= n ; i ++ ) { cin >> v[ i ] ; } for ( int i = 1; i <= m ; i ++ ) cin >> b[ i ] ; vector<int> posib [ n + 2] ; vector<int> posixor[ n + 2] ; posixor [ 1 ] .push_back(0); for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 0 ; j < ( 1 << m ) ; j ++ ) { int sum = 0 ; for ( int f = 1 ; f <= m ; f ++ ) { if ( j & ( 1 << ( f - 1 ) ) ) sum += b[ f ] ; } if ( sum == v[ i ] ) { posib [ i ] .push_back( j ) ; } } if ( posib[ i ] .size() == 0 || posixor [ i ] .size() == 0 ) { cout << "NO" << '\n'; return 0 ; } for ( int d = 0 ; d < posixor [ i ] .size() ; d ++ ) { long long j = posixor [ i ][ d ] ; for (int k = 0 ; k < posib [ i ] .size() ; k ++ ) { if ( (( j ) & ( posib [ i ][ k ] )) == 0 ) { int val = (posib [ i ][ k ] | ( j )); posixor [ i + 1] .push_back(val); if ( i == n ) { cout << "YES" << '\n'; return 0 ; } } } } } cout << "NO" << '\n'; return 0; }

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

bank.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("unroll-loops")
      | 
bank.cpp: In function 'int main()':
bank.cpp:52:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         for ( int d = 0 ; d < posixor [ i ] .size() ; d ++ )
      |                           ~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:56:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             for  (int k = 0 ; k < posib [ i ] .size() ; k ++ )
      |                               ~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...