제출 #1172706

#제출 시각아이디문제언어결과실행 시간메모리
1172706uranhishigBikeparking (EGOI24_bikeparking)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
const int mod = 1e9 + 7;
const int mx = 3e5 + 5;

signed main() {
	int n;	cin >> n;
	vector<int> a(n);
	bool ok = true;
	int xx;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		xx = a[i];
		if (i > 0) {
			if (a[i] != a[0]) ok = false;
		}
	}
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
		if (i > 0) {
			if (b[i] != b[0]) ok = false;
			if (a[i] != b[i]) ok = false;
		}
	}
	if (ok) {
		if(n<3) {
			cout<<"0";
			return 0;
		}
		cout << (n - 2) * xx;
		return 0;
	}
	int ans = 0;
	for (int  i = n - 2; i >= 0; i--) {
		while (int x = *upper_bound(b.begin(), b.end(), a[i]) and b[x] > 0 and x > 0 aand i < x) {
			int mn = min(a[i], b[x]);
			a[i] -= mn;
			b[x] -= mn;
			ans += mn;
		}
	}
	for (int i = 0; i < n; i++ ) {
		int t = min(a[i], b[i]);
		a[i] -= t;	b[i] -= t;
	} 
	for (int i = 0; i < n; i++) {
		if (b[i] > 0) {
			ans -= b[i];
		}
	}
	cout << ans << "\n";
	return 0;
}

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

Main.cpp: In function 'int main()':
Main.cpp:44:93: error: expected ')' before 'aand'
   44 |                 while (int x = *upper_bound(b.begin(), b.end(), a[i]) and b[x] > 0 and x > 0 aand i < x) {
      |                       ~                                                                     ^~~~~
      |                                                                                             )
Main.cpp:44:94: error: 'aand' was not declared in this scope; did you mean 'rand'?
   44 |                 while (int x = *upper_bound(b.begin(), b.end(), a[i]) and b[x] > 0 and x > 0 aand i < x) {
      |                                                                                              ^~~~
      |                                                                                              rand