This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Memory_lib.h"
#include <bits/stdc++.h>
using namespace std;
//-------------------------------//
/*
string s;
int n;
int wa=0;
bool was;
char Get(int i)
{
if(i<1 || i>n) wa=1;
if(was) wa=6;
was=1;
return s[i-1];
}
*/
//-------------------------------//
int Memory(int n, int m)
{
auto Build=[](int l, int r, int b, int t){ return l+r*128+b*128*128+t*128*128*128;};
int l=m%128;
int r=(m/128)%128;
int b=(m/128/128)%128;
int t=(m/128/128/128)%2;
if(l>n || r>n+1 || b>n) return 0;
if(l==0)
{
l=1,b=1;
char c=Get(1);
if(c=='>' || c==']') r=l-1;
else r=l+1;
if(c=='<' || c=='>') t=1;
else t=0;
return Build(l,r,b,t);
}
if(b==0)
{
l++;b=1;
if(l>n) return -1;
char c=Get(l);
if(c=='>' || c==']') r=l-1;
else r=l+1;
if(c=='<' || c=='>') t=1;
else t=0;
return Build(l,r,b,t);
}
else
{
if(r==0 || r==n+1){ Get(1);return -2;}
if(l<r)
{
char c=Get(r);r++;
if(c=='>' || c==']') b--;
else b++;
if(b==0)
{
if(t==1 && c==']') return -2;
if(t==0 && c=='>') return -2;
}
return Build(l,r,b,t);
}
else
{
char c=Get(r);r--;
if(c=='<' || c=='[') b--;
else b++;
if(b==0)
{
if(t==1 && c=='[') return -2;
if(t==0 && c=='<') return -2;
}
return Build(l,r,b,t);
}
}
}
//-------------------------------//
/*
int Play()
{
int m=0,potez;
wa=0;
for(potez=1;potez<=15000;potez++)
{
was=0;
m=Memory(n,m);
if(wa) return -3;
if(m>=(1<<22)){ wa=2;return -3;}
if(m<=-3){ wa=3;return m;}
if(m<0) break;
}
if(potez>15000) wa=4;
return m;
}
void Run(string f)
{
ifstream in(f+".in"),sol(f+".txt");
int t;
in>>n>>t;
int cnt_wa[7]={0};
for(int i=1;i<=t;i++)
{
in>>s;
int out=Play();
int ans;sol>>ans;
if(!wa && out!=ans) wa=5;
cnt_wa[wa]++;
}
cout<<f<<": ";
for(int i=0;i<=6;i++) cout<<cnt_wa[i]<<" ";
cout<<endl;
}
int main()
{
set<string> st={"sample-01","01-01","01-02","01-03","02-01","03-01","04-01","05-01","06-01","06-02"};
for(string f:st) Run(f);
return 0;
}
*/
//-------------------------------//
# | 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... |