답안 #603167

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
603167 2022-07-23T16:26:08 Z Apiram Snowball (JOI21_ho_t2) C++14
33 / 100
2500 ms 2380 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m;cin>>n>>m;
	vector<long long>arr(n);
	for (int i = 0;i<n;++i){
		cin>>arr[i];
	}
	vector<long long>ans(n);
	long long maxxy = 0,minny = 0;
	long long sum = 0;
	for (int i = 0;i<m;++i){
		long long x;cin>>x;
		sum+=x;
		if (maxxy < sum){
			for (int j = 0;j<n;++j){
				if (j == n - 1){
					ans[j] +=(sum - maxxy);
				}
				else{
					ans[j]+=max(0LL,min(arr[j] + sum,arr[j + 1] + minny) - (arr[j] + maxxy));
				}
			}
			maxxy = sum;
		}
		else if (minny > sum){
			for (int j = 0;j<n;++j){
				if (j == 0){
					ans[j]+=-(sum - minny);
				}
				else{
					ans[j]+=max(0LL,(arr[j] + minny) - max((arr[j - 1] + maxxy),arr[j] + sum)); 
				}
			}
			minny = sum;
		}
	}
	for (auto x:ans)cout<<x<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 8 ms 400 KB Output is correct
5 Correct 7 ms 392 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 6 ms 340 KB Output is correct
8 Correct 6 ms 328 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 11 ms 340 KB Output is correct
16 Correct 7 ms 388 KB Output is correct
17 Correct 8 ms 468 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 8 ms 400 KB Output is correct
5 Correct 7 ms 392 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 6 ms 340 KB Output is correct
8 Correct 6 ms 328 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 11 ms 340 KB Output is correct
16 Correct 7 ms 388 KB Output is correct
17 Correct 8 ms 468 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 36 ms 2380 KB Output is correct
21 Correct 40 ms 2200 KB Output is correct
22 Correct 83 ms 2048 KB Output is correct
23 Correct 631 ms 1860 KB Output is correct
24 Execution timed out 2551 ms 1512 KB Time limit exceeded
25 Halted 0 ms 0 KB -