답안 #135442

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
135442 2019-07-24T05:43:48 Z 임유진(#3251) MP3 Player (CEOI10_mp3player) C++14
10 / 100
16 ms 764 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 4005;
const int INF = 1 << 31;

char b[MAXN];
int t[MAXN];
int tc[MAXN];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int N, Vm, V2;

	cin >> N >> Vm >> V2;
	for(int i = 0; i < N; i++) cin >> b[i] >> t[i];

	for(int i = N - 1; i > 0; i--) t[i] -= t[i - 1];
	//for(int i = 0; i < N; i++) printf("%d ", t[i]);
	//printf("\n");
	tc[0] = INF;
	for(int i = 1; i < N; i++) tc[i] = t[i];
	sort(tc, tc + N);
	for(int i = N - 1; i >= 0; i--) {
		int s = V2, e = V2;
		bool ava = true;
		for(int j = N - 1; j > 0; j--) if(t[j] <= tc[i]) {
			if(b[j] == '+') {
				s = max(0, s - 1);
				e = e == Vm ? Vm : e - 1;
			}
			else {
				s = s == 0 ? 0 : s + 1;
				e = min(Vm, e + 1);
			}
			if(s > e) {
				ava = false;
				break;
			}
		}
		if(ava) {
			if(i == N - 1) cout << "infinity";
			else cout << tc[i] << " " << e;
			return 0;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Incorrect 16 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 764 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -