Submission #282820

# Submission time Handle Problem Language Result Execution time Memory
282820 2020-08-25T03:02:20 Z arnold518 None (JOI15_memory) C++14
0 / 100
2822 ms 283788 KB
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int encode(int sz, int mch, int st)
{
	return (st<<8)|(mch<<4)|(sz);
}

int Memory(int N, int M)
{
	if(N%2) return -2;
	int sz=M&15; M>>=4;
	int mch=M&15; M>>=4;
	int st=M;
	char c=Get(mch*2+sz+1);

	if(c=='<')
	{
		st<<=1;
		sz++;
		if(sz>N/2) return -2;
	}
	else if(c=='[')
	{
		st<<=1;
		st|=1;
		sz++;
		if(sz>N/2) return -2;
	}
	else if(c=='>')
	{
		if(sz==0) return -2;
		if((st&1)!=0) return -2;
		sz--; st>>=1; mch++;
	}
	else if(c==']')
	{
		if(sz==0) return -2;
		if((st&1)!=1) return -2;
		sz--; st>>=1; mch++;
	}

	if(mch*2+sz==N)
	{
		if(sz==0) return -1;
		return -2;
	}
	return encode(sz, mch, st);
}
# Verdict Execution time Memory Grader output
1 Correct 2822 ms 283788 KB Output is correct
2 Incorrect 1 ms 256 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2822 ms 283788 KB Output is correct
2 Incorrect 1 ms 256 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2822 ms 283788 KB Output is correct
2 Incorrect 1 ms 256 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2822 ms 283788 KB Output is correct
2 Incorrect 1 ms 256 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong Answer [1]
# Verdict Execution time Memory Grader output
1 Correct 2822 ms 283788 KB Output is correct
2 Incorrect 1 ms 256 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -