Submission #135442

# Submission time Handle Problem Language Result Execution time Memory
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;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -