Submission #154101

# Submission time Handle Problem Language Result Execution time Memory
154101 2019-09-18T11:12:48 Z maruii None (JOI15_memory) C++14
10 / 100
2800 ms 283368 KB
#include "Memory_lib.h"

int Memory(int N, int M) {
	int a, s, e, v;
	a = M >> 21;
	s = (M >> 14) & ((1 << 7) - 1);
	e = (M >> 7) & ((1 << 7) - 1);
	v = M & ((1 << 7) - 1);
	if (s == N) return -1;
	if (e >= N) return -2;
	char c = Get(e + 1);
	if (s == 0) {
		if (c == '>' || c == ']') v--;
		else v++;
		if (v < 0 || (e + 1 == N && v)) return -2;
		if (e + 1 == N) return 1 << 14;
		return (e + 1) << 7 | v;
	}
	return -1;
	if (s == e + 1) {
		if (c == '>' || c == ']') return ((s + 1) << 14) | (s << 7);
		a = c != '<';
		return (a << 21) | (s << 14) | (s << 7) | 1;
	}
	if (c == '>' || c == ']') v--;
	else v++;
	if (v == 0) {
		if (a ^ (c != '>')) return -2;
		return ((s + 1) << 14) | (s << 7);
	}
	return (a << 21) | (s << 14) | ((e + 1) << 7) | v;
}
# Verdict Execution time Memory Grader output
1 Correct 2682 ms 283368 KB Output is correct
2 Incorrect 2619 ms 283012 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2682 ms 283368 KB Output is correct
2 Incorrect 2619 ms 283012 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2682 ms 283368 KB Output is correct
2 Incorrect 2619 ms 283012 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2682 ms 283368 KB Output is correct
2 Incorrect 2619 ms 283012 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2800 ms 282996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2682 ms 283368 KB Output is correct
2 Incorrect 2619 ms 283012 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -