답안 #203792

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
203792 2020-02-22T07:52:41 Z dennisstar Safety (NOI18_safety) C++17
0 / 100
93 ms 2792 KB
#include <bits/stdc++.h>
#define em emplace
using namespace std;
typedef long long ll;

priority_queue<ll> L, R;
int N; ll H, S, A;

int main() {
	cin>>N>>H;
	for (int i=1; i<=N; i++) {
		cin>>S;
		if (i==1) { L.em(S), R.em(-S); continue; }
		if (S<L.top()-H*(i-1)) A+=(L.top()-H*(i-1))-S, L.em(S+H*(i-1));
		else if (S>-R.top()+H*(i-1)) A+=S+R.top()-H*(i-1), R.em(-S+H*(i-1));
		else L.em(S+H*(i-1)), R.em(-S+H*(i-1));
	}
	cout<<A<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 93 ms 2792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -