제출 #1127860

#제출 시각아이디문제언어결과실행 시간메모리
1127860zhasyn은행 (IZhO14_bank)C++20
컴파일 에러
0 ms0 KiB
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 1e6 + 1e5 + 10;
const ll mod = 998244353;

ll um(ll a, ll b){
	return ((1LL * a * b) % mod + mod) % mod;
}
ll subr(ll a, ll b){
	return ((1LL * a - b) % mod + mod) % mod;
}
int a[N], b[N], n, m;
int dp[N], last[N];
int main() {
	ios::sync_with_stdio(false);
  	cin.tie(NULL);
  	//freopen("bank.in", "r", stdin);
  	//freopen("bank.out", "w", stdout);
  	cin >> n >> m;
  	for(int i = 0; i < n; i++){
  		cin >> a[i];
  	}
  	for(int i = 0; i < m; i++){
  		cin >> b[i];
  	}
  	bool can = false;
  	for(int mask = 0; mask < (1 << m); mask++){
  		dp[mask] = -1;
  	}
  	dp[0] = 0;
  	for(int mask = 0; mask < (1 << m); mask++){
  		for(int dig = 0; dig < m; dig++){
  			if((mask & (1 << dig)) > 0){
  				int nw = mask ^ (1 << dig);
  				int mx = dp[nw], rest = last[nw];
  				
  				if(dp[nw] == -1) continue;
  				if(last[nw] + b[dig] == a[dp[nw]]){
  					mx++;
  					rest = 0;
  				} else rest += b[dig];
  				
  				if(mx >= dp[mask]){
  					dp[mask] = mx;
  					last[mask] = rest;
  				}
  			}
  		}
  		if(dp[mask] == n){
			can = true;
			break;
		}
  	}
  	if(can) cout << "YES\n";
  	else cout << "NO\n";
  return 0;
}

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

bank.cpp: In function 'int main()':
bank.cpp:19:9: error: 'ios' has not been declared
   19 |         ios::sync_with_stdio(false);
      |         ^~~
bank.cpp:20:9: error: 'cin' was not declared in this scope
   20 |         cin.tie(NULL);
      |         ^~~
bank.cpp:20:17: error: 'NULL' was not declared in this scope
   20 |         cin.tie(NULL);
      |                 ^~~~
bank.cpp:1:1: note: 'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | #define F first
bank.cpp:58:17: error: 'cout' was not declared in this scope
   58 |         if(can) cout << "YES\n";
      |                 ^~~~
bank.cpp:59:14: error: 'cout' was not declared in this scope
   59 |         else cout << "NO\n";
      |              ^~~~