답안 #1029657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029657 2024-07-21T07:11:55 Z mansur Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>

using namespace std;

#define rall(s) s.rbegin() s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	int a[n + 1];
	for (int i= 1; i <= n; i++) cin >> a[i];
	int q;
	cin >> q;
	while (q--) {
		int tp;
		cin >> tp;
		if (tp == 1) {
			int x, y;
			cin >> x >> y;
			a[x] = y;
		}else {
			int l, r;
			cin >> l >> r;
			int ans = 0;
			for (int i = l; i <= r; i++) {
				ll sum = a[i];
				int tl = i - 1, tr = i + 1, ok = 1;
				while (tl >= l || tr <= r) {
					if (tl >= l && sum >= a[tl]) {
						sum += a[tl];
						tl--;
						continue;
					}
					if (tr <= r && sum >= a[tr]) {
						sum += a[tr];
						tr++;
						continue;
					}
					ok = 0;
					break;
				}
				ans += ok;
			}
			cout << ans << ' ';
		}
	}
}

Compilation message

/usr/bin/ld: /tmp/ccR5lvhs.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXt2Jst.o:dango3.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccR5lvhs.o: in function `main':
grader.cpp:(.text.startup+0x111): undefined reference to `Solve(int, int)'
collect2: error: ld returned 1 exit status