Submission #135448

# Submission time Handle Problem Language Result Execution time Memory
135448 2019-07-24T05:49:35 Z 임유진(#3251) MP3 Player (CEOI10_mp3player) C++14
30 / 100
22 ms 556 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] - 1;
	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 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 11 ms 376 KB Output is correct
3 Correct 15 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 376 KB Output is correct
2 Correct 22 ms 376 KB Output is correct
3 Correct 19 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 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 504 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 504 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 504 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 504 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 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -