제출 #922399

#제출 시각아이디문제언어결과실행 시간메모리
922399Nurislam은행 (IZhO14_bank)C++17
19 / 100
100 ms600 KiB
#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; #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int long long #define double long double #define order_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ///* __ __ __ */ ///* ====== _ /| /| __ _ / | | /| | @ | | | | / /| |\ | / | | @ | / */ ///* \- || |_| |_ / |/ | | | |_ |- | |--| /-| | | \ \ |==| |- /=| | \ | | |--| | |- */ ///* || | | |_ / | |__| _| |_ \__ | | / | |__ | __| | | | \ / | | \| \__ | | | | \ */ ///* typedef vector<int> vi; typedef vector<double> vd; typedef pair<int,int> pii; typedef vector<pii> vii; typedef vector<vi> vv; const int N = 2e5+4, inf = 1e8, mod = 998244353; void solve(){ int n, m; cin >> n >> m; int cnt = 0, us[m]{}; vi b(m); map<int,int> mp; for(int i = 0, x; i < n; i++){cin >> x;mp[x]++;} for(int &i:b)cin >> i; sort(all(b)); //~ for(int i:b)cout << i << ' '; //~ cout << '\n'; for(int ms = 0; ms < (1<<m); ms++){ int sum = 0, ok = 0; for(int i = 0; i < m; i++){ if((ms>>i)&1){ sum+=b[i]; if(us[i])ok = 1; } } if(ok)continue; //~ cout << sum << '\n'; if(mp[sum] > 0){ mp[sum]--; cnt++; for(int i = 0; i < m; i++){ if((ms >> i)&1)us[i] = 1; } } } if(cnt == n)cout << "YES\n"; else cout << "NO\n"; } main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int test = 1; //~ cin >> test; while(test--){ solve(); } }

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

bank.cpp:64:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   64 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...