wasa855's blog

By wasa855, history, 4 years ago, In English

Are there any mistakes in the special judge of problem 1078E?

I wrote my own special judge to check my answer and it passed, so I think the special judge is wrong.

Or anyone can find mistakes in my code or my special judge?

Thanks a lot. If you can help me, I believe you can find a girlfriend easily. (

upd: My construct method also passed special judges written by my friends. But my friends and I submitted different construct methods, and discoverd that the official special judge might don't support doing operation t many times.

My Code:

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
void init1()
{
	cout<<"dd";
	for(int i=1;i<=32;i++) cout<<"0l";
	cout<<"d";
	for(int i=1;i<=32;i++) cout<<"r1";
	cout<<"uu";
	for(int i=1;i<=32;i++) cout<<"sut0ddtl";
	for(int i=1;i<=32;i++) cout<<"r";
	cout<<"u";
}
void init2()
{
	cout<<"uuu";
	for(int i=1;i<=32;i++) cout<<"0l";
	cout<<"u";
	for(int i=1;i<=32;i++) cout<<"r1";
	cout<<"dd";
	for(int i=1;i<=32;i++) cout<<"sdt0uutl";
	for(int i=1;i<=32;i++) cout<<"r";
	cout<<"dd";
}
void cpy(char m) {printf("10%ct",m);}
void getd()
{
	cout<<"uu"; cout<<"100dsdttt";
	cout<<"u"; cpy('d'); cout<<"u"; cpy('d');
	cout<<"ddddl";
	for(int i=2;i<=32;i++)
	{
		cout<<"d"; cpy('u');
		for(int j=i-1;j>=-1;j--)
		{
			cout<<"r"; cpy('l');
		}
		cout<<"u"; cpy('d');
		cout<<"u"; cpy('d');
		cout<<"u"; cpy('d');
		cout<<"u"; cpy('d');
		for(int j=0;j<=i-1;j++) cout<<"l",cpy('r');
		cout<<"d";
		cout<<"100usuttt";
		cout<<"l"; cpy('r');
		cout<<"u"; cpy('d');
		cout<<"d"; cpy('d');
		cout<<"r"; cpy('l');
		cout<<"u"; cpy('d');
		cout<<"d";
		cout<<"100usuttt";
		cout<<"l"; cpy('r');
		cout<<"uu1110dsdttt";
		cout<<"d"; cpy('u');
		cout<<"d100dsdttt";
		cout<<"uu1110dsdttt";
		cout<<"ddddl";
	}
	cout<<"uuuur";
	for(int i=32;i>=1;i--)
	{
		cout<<"l"; cpy('r');
		cout<<"rr";
	}
	cout<<"ddddl";
}
void gete()
{
	cout<<"uu0110dsdttt";
	for(int i=2;i<=32;i++)
	{
		cout<<"l0110dsdttt";
		cout<<"u"; cpy('d');
		cout<<"d0110usuttt";
	}
	for(int i=32;i>=1;i--) cout<<"r";
}
signed main()
{
	init1(); init2();
	getd();
	gete();
	cout<<"l";
	for(int i=1;i<=31;i++) cout<<"l";
	return 0;
}

My Special Judge:

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
#define N 1000005
map<pii,int> a;
int opt[N],res[N],ct;
char ans_file[N],in_file[N];
int x,y;
void print()
{
	for(int j=5;j>=-40;j--)
	{
		for(int i=-40;i<=5;i++)
		{
			if(i==x&&j==y)
			{
				if(a[{i,j}]==0) printf("\e[31m.\e[0m");
				else printf("\e[31m%d\e[0m",a[{i,j}]-1);
			}
			else
			{
				if(a[{i,j}]==0) printf(".");
				else printf("%d",a[{i,j}]-1);
			}
		}
		cout<<"\n";
	}
}
signed main(int argc,char *args[])
{
	sprintf(ans_file,"%s",args[1]);
	sprintf(in_file,"%s",args[2]);
	freopen(ans_file,"r",stdin);
	string s; cin>>s; assert(s.size()<=1e5);
	freopen(in_file,"r",stdin);
	x=read(),y=read();
	for(int i=0;x;i--,x/=2) a[{i,0}]=(x&1)+1;
	for(int i=0;y;i--,y/=2) a[{i,1}]=(y&1)+1;
	x=0,y=0;
	print();
	cout<<"\n\n";
	for(char i:s)
	{
		ct++; opt[ct]=i;
		if(i=='0') res[ct]=a[{x,y}],a[{x,y}]=1;
		else if(i=='1') res[ct]=a[{x,y}],a[{x,y}]=2;
		else if(i=='l') x--;
		else if(i=='r') x++;
		else if(i=='u') y++;
		else if(i=='d') y--;
		else if(i=='s') continue;
		else if(i=='t')
		{
			int val=a[{x,y}]; ct--;
			for(int j=1;j<=val;j++)
			{
				char ch=opt[ct];
				if(ch=='0') a[{x,y}]=res[ct];
				else if(ch=='1') a[{x,y}]=res[ct];
				else if(ch=='l') x++;
				else if(ch=='r') x--;
				else if(ch=='u') y--;
				else if(ch=='d') y++;
				ct--;
			}
		}
		else assert(0);
	}
	print();
	return 0;
}

QAQ

Full text and comments »

  • Vote: I like it
  • +81
  • Vote: I do not like it