이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Memory_lib.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdio.h>
using namespace std;
int Memory(int N, int M) {
	//cout<<N<<" "<<M<<endl;
	int k = (M>>20);
	int t = M%(1<<20);
	int a = t/10000, b = (t/100)%100, c = (t%100);
	if(a>N-1 || b>N-1 || c>N-1)	return -2;
	char ch = Get(b+1);
	//cout<<k<<" "<<a<<" "<<b<<" "<<c<<" "<<ch<<endl;
	if(a==0){
		if(k==0){
			if(ch=='<')	k = 1;
			else if(ch=='[')	k = 2;
		}else{
			return -2;/*
			if(k==1){
				if(c!=0 || ch!='>'){
					return -2;
				}
			}else{
				if(c!=0 || ch!=']'){
					return -2;
				}
			}
			k = 0;
			c = 0;*/
		}
	}
	if(k==0){
		if(ch=='<' || ch=='['){
			a--;
			if(a<0)	return -2;
		}
		else{
			a++;
		}	
	}
	if(k!=0){
		if(ch=='<' || ch=='['){
			a++;
		}
		else{
			a--;
			if(a<0)	return -2;
		}	
		if(k==1){
			if(ch=='<'){
				c++;
			}else if(ch=='>'){
				c--;
				if(c<0)	return -2;
			}
		}else{
			if(ch=='['){
				c++;
			}else if(ch==']'){
				c--;
				if(c<0)	return -2;
			}
		}
		if(a==0 || c==0){
			if(a!=0 || c!=0)	return -2;
			k = 0;
		}
	}
	if(b==N-1){
		if(k!=0)	return -2;
		if(a==N-1)	return -1;
		b = 0;
		a++;
		c = 0;
	}else{
		b++;
	}
	int K = (k<<20) + a*10000 + b*100 + c;
	return K;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |