Submission #199199

# Submission time Handle Problem Language Result Execution time Memory
199199 2020-01-30T03:38:54 Z arnold518 None (JOI15_memory) C++14
25 / 100
2787 ms 284024 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 Memory(int N, int M)
{
	int i, j;

	if(N%2) return -2;

	int pos=(M&31)+1, sz=(M>>5)&15, mask=M>>9;
	if(sz>N/2) return -2;
	if(mask>=(1<<sz)) return -2;
	if(pos==N+1)
	{
		if(sz==0 && mask==0) return -1;
		return -2;
	}
	if(pos>N) return -2;

	char t=Get(pos);

	if(t=='<')
	{
		mask<<=1; sz++;
		if(sz>N/2) return -2;
	}
	else if(t=='[')
	{
		mask<<=1; sz++;
		mask|=1;
		if(sz>N/2) return -2;
	}
	else if(t=='>')
	{
		if(sz==0) return -2;
		if((mask&1)==1) return -2;
		sz--; mask>>=1;
	}
	else if(t==']')
	{
		if(sz==0) return -2;
		if((mask&1)==0) return -2;
		sz--; mask>>=1;
	}
	pos++;

	return (mask<<9)|(sz<<5)|(pos-1);
}

Compilation message

memory.cpp: In function 'int Memory(int, int)':
memory.cpp:11:6: warning: unused variable 'i' [-Wunused-variable]
  int i, j;
      ^
memory.cpp:11:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# Verdict Execution time Memory Grader output
1 Correct 2787 ms 283788 KB Output is correct
2 Correct 2634 ms 284024 KB Output is correct
3 Correct 2641 ms 283868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2787 ms 283788 KB Output is correct
2 Correct 2634 ms 284024 KB Output is correct
3 Correct 2641 ms 283868 KB Output is correct
4 Correct 2635 ms 283872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2787 ms 283788 KB Output is correct
2 Correct 2634 ms 284024 KB Output is correct
3 Correct 2641 ms 283868 KB Output is correct
4 Correct 2635 ms 283872 KB Output is correct
5 Correct 2650 ms 283944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2787 ms 283788 KB Output is correct
2 Correct 2634 ms 284024 KB Output is correct
3 Correct 2641 ms 283868 KB Output is correct
4 Correct 2635 ms 283872 KB Output is correct
5 Correct 2650 ms 283944 KB Output is correct
6 Incorrect 5 ms 256 KB Wrong Answer [1]
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Wrong Answer [1]
# Verdict Execution time Memory Grader output
1 Correct 2787 ms 283788 KB Output is correct
2 Correct 2634 ms 284024 KB Output is correct
3 Correct 2641 ms 283868 KB Output is correct
4 Correct 2635 ms 283872 KB Output is correct
5 Correct 2650 ms 283944 KB Output is correct
6 Incorrect 5 ms 256 KB Wrong Answer [1]