| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 397678 | ChrisT | Snowball (JOI21_ho_t2) | C++17 | 155 ms | 15300 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e6 + 5;
int main () {
	int n,q; scanf ("%d %d",&n,&q);
	vector<long long> x(n), go(q);
	for (int i = 0; i < n; i++) scanf ("%lld",&x[i]);
	for (int i = 0; i < q; i++) scanf ("%lld",&go[i]);
	vector<long long> left(q), right(q);
	long long pre = 0;
	for (int i = 0; i < q; i++) {
		pre += go[i];
		left[i] = min(pre,i?left[i-1]:0LL);
		right[i] = max(pre,i?right[i-1]:0LL);
	}
	vector<long long> ret(n);
	for (int i = 1; i < n; i++) {
		int low = 0, high = q-1, mid, ans = -1;
		while (low <= high) {
			mid = (low + high) / 2;
			if (x[i-1] + right[mid] >= x[i] + left[mid]) high = (ans = mid) - 1;
			else low = mid + 1;
		}
		if (ans == -1) ret[i-1] += right[q-1], ret[i] -= left[q-1];
		else if (go[ans] > 0) {
			long long cut = x[i] + left[ans];
			ret[i] += x[i] - cut;
			ret[i-1] += cut - x[i-1];
		} else {
			long long cut = x[i-1] + right[ans];
			ret[i-1] += cut - x[i-1];
			ret[i] += x[i] - cut;
		}
	}
	ret[0] -= left[q-1]; ret[n-1] += right[q-1];
	for (int i = 0; i < n; i++) printf ("%lld\n",ret[i]);
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
