제출 #1307543

#제출 시각아이디문제언어결과실행 시간메모리
1307543lvsTug of War (BOI15_tug)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long
#define zet ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 6e4+555, M = 1e6+557, mod = 1e9+7;
int n, k, l[N], r[N], a[N], dp[N][5];
vector <int> st;
bool res;
vector <pair<int, int>>mp;

bool comp(pair<int, int> a, pair<int, int> b) {
	return a.second <= b.second;
}
signed  main() {
	zet
	cin >> n >> k;
	for (int i = 0; i < 2*n; i++) {
		cin >> l[i] >> r[i] >> a[i];
	}
	for (int mk = 1; mk < (1 << (2*n)); mk++) {
		int cnt = 0;
		bool ll[n+5], rr[n+5];
		for (int i = 0; i <= n; i++) ll[i] = r[i] = 0;
		for (int i = 0; i < 2*n; i++) {
			if ((1<<i)&mk) cnt++;
		}
		if (cnt != n) continue;
		int ans = 0;
		bool x = 0;
		for (int i = 0; i < 2*n; i++) {
			if ((1<<i) & mk) {
				ll[l[i]]++;
				if (ll[l[i]] > 1) {
					x = 1;
					break;
				}
				ans += a[i];
			}
			else {
				rr[r[i]]++;
				if (rr[r[i]] > 1) {
					x = 1;
					break;
				}
				ans -= a[i];
			}
		}
		if (abs(ans) <= k && !x){
			res = 1;
			break;
		}
	}
	cout << ((res) ? "YES" : "NO");
}

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

tug.cpp: In function 'int main()':
tug.cpp:32:40: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   32 |                                 ll[l[i]]++;
      |                                 ~~~~~~~^
tug.cpp:40:40: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   40 |                                 rr[r[i]]++;
      |                                 ~~~~~~~^