Submission #154111

# Submission time Handle Problem Language Result Execution time Memory
154111 2019-09-18T11:22:53 Z maruii None (JOI15_memory) C++14
100 / 100
2695 ms 283340 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;
	}
	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 2578 ms 283192 KB Output is correct
2 Correct 2603 ms 283144 KB Output is correct
3 Correct 2608 ms 283084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2578 ms 283192 KB Output is correct
2 Correct 2603 ms 283144 KB Output is correct
3 Correct 2608 ms 283084 KB Output is correct
4 Correct 2597 ms 283228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2578 ms 283192 KB Output is correct
2 Correct 2603 ms 283144 KB Output is correct
3 Correct 2608 ms 283084 KB Output is correct
4 Correct 2597 ms 283228 KB Output is correct
5 Correct 2661 ms 282996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2578 ms 283192 KB Output is correct
2 Correct 2603 ms 283144 KB Output is correct
3 Correct 2608 ms 283084 KB Output is correct
4 Correct 2597 ms 283228 KB Output is correct
5 Correct 2661 ms 282996 KB Output is correct
6 Correct 2629 ms 283232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2695 ms 283128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2578 ms 283192 KB Output is correct
2 Correct 2603 ms 283144 KB Output is correct
3 Correct 2608 ms 283084 KB Output is correct
4 Correct 2597 ms 283228 KB Output is correct
5 Correct 2661 ms 282996 KB Output is correct
6 Correct 2629 ms 283232 KB Output is correct
7 Correct 2695 ms 283128 KB Output is correct
8 Correct 2692 ms 283340 KB Output is correct
9 Correct 2685 ms 282892 KB Output is correct