답안 #592409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592409 2022-07-09T07:13:19 Z joelau 기억 압축 (JOI15_memory) C++14
30 / 100
2131 ms 284332 KB
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;

int Memory(int N, int M) {
	int n = M%30, x = M/30;
	if (n >= N) return -2;
	if (x == 0) x = 1;
	if (x >= (1<<16)) return -2;
	char c = Get(n+1);
	if (c == '<') x = x * 2;
	if (c == '[') x = x * 2 + 1;
	if (c == '>') {
		if (x % 2 == 1) return -2;
		else x /= 2;
	}
	if (c == ']') {
		if (x == 1 || x % 2 == 0) return -2;
		else x /= 2;
	}
	if (n == N-1) {
		if (x == 1) return -1;
		else return -2;
	}
	else {
		int nxt = x * 30 + n + 1;
		if (nxt >= (1<<22)) return -2;
		else return nxt;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2094 ms 284104 KB Output is correct
2 Correct 2101 ms 284020 KB Output is correct
3 Correct 2131 ms 284068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2094 ms 284104 KB Output is correct
2 Correct 2101 ms 284020 KB Output is correct
3 Correct 2131 ms 284068 KB Output is correct
4 Correct 2050 ms 284092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2094 ms 284104 KB Output is correct
2 Correct 2101 ms 284020 KB Output is correct
3 Correct 2131 ms 284068 KB Output is correct
4 Correct 2050 ms 284092 KB Output is correct
5 Correct 2106 ms 284108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2094 ms 284104 KB Output is correct
2 Correct 2101 ms 284020 KB Output is correct
3 Correct 2131 ms 284068 KB Output is correct
4 Correct 2050 ms 284092 KB Output is correct
5 Correct 2106 ms 284108 KB Output is correct
6 Correct 2077 ms 284332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2037 ms 284164 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2094 ms 284104 KB Output is correct
2 Correct 2101 ms 284020 KB Output is correct
3 Correct 2131 ms 284068 KB Output is correct
4 Correct 2050 ms 284092 KB Output is correct
5 Correct 2106 ms 284108 KB Output is correct
6 Correct 2077 ms 284332 KB Output is correct
7 Incorrect 2037 ms 284164 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -