Submission #599588

# Submission time Handle Problem Language Result Execution time Memory
599588 2022-07-19T16:10:13 Z joelau None (JOI15_memory) C++14
0 / 100
1981 ms 284084 KB
#include "Memory_lib.h"
using namespace std;

int Memory(int N, int M) {
	int a = M & ((1<<7)-1); M >>= 7;
	if (a == N) return -1;
	if (a > N) return -2;
	int b = M & ((1<<7)-1); M >>= 7;
	if (b >= N || b < a) return -2;
	int c = M & ((1<<7)-1); M >>= 7;
	if (c > b-a) return -2;
	char ch = Get(b+1);
	if (a == b) {
		if (ch == '<') return (c<<14) | ((b+1)<<7) | a;
		else if (ch == '[') return (1<<21) | (c<<14) | ((b+1)<<7) | a;
		else if (a == 0) return -2;
		else return (c<<14) | ((b+1)<<7) | (a+1);
	}
	else {
		if (ch == '<' || ch == '[') return (M<<21) | ((c+1)<<14) | ((b+1)<<7) | a;
		if (c > 0) return (M<<21) | ((c-1)<<14) | ((b+1)<<7) | a;
		if (ch == '>' && M == 1) return -2;
		if (ch == ']' && M == 0) return -2;
		return ((a+1)<<7) | (a+1);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1938 ms 284076 KB Output is correct
2 Correct 1924 ms 283976 KB Output is correct
3 Incorrect 1888 ms 284000 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1938 ms 284076 KB Output is correct
2 Correct 1924 ms 283976 KB Output is correct
3 Incorrect 1888 ms 284000 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1938 ms 284076 KB Output is correct
2 Correct 1924 ms 283976 KB Output is correct
3 Incorrect 1888 ms 284000 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1938 ms 284076 KB Output is correct
2 Correct 1924 ms 283976 KB Output is correct
3 Incorrect 1888 ms 284000 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1981 ms 284084 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1938 ms 284076 KB Output is correct
2 Correct 1924 ms 283976 KB Output is correct
3 Incorrect 1888 ms 284000 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -