QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#509080#7516. Robot Experimentclocky#WA 0ms3764kbC++141.1kb2024-08-08 09:36:282024-08-08 09:36:28

Judging History

你现在查看的是最新测评结果

  • [2024-08-08 09:36:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3764kb
  • [2024-08-08 09:36:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
	set<pair<int,int> > ji;
		int n;
		string s;
		deque<pair<int,int> >q;

		int t=0,t1=0; 
		bool a[5];
	void bfs(int x){
			ji.insert({t,t1}); 
		if(x==s.size()){
		return; 
		} 
			if(s[x]=='L'&&!a[1]){			
			bfs(x+1);
			 }
			if(s[x]=='R'&&!a[2]){	
			bfs(x+1);
			 }
		if(s[x]=='U'&&!a[3]){				
			bfs(x+1);
			 }
			if(s[x]=='D'&&!a[4]){		
			bfs(x+1);
			 }
		if(s[x]=='L'&&a[1]){
			a[1]=false;				
			bfs(x+1);
			a[1]==true;
			 	t--;
				 bfs(x+1);
			 	t++;
			 }
			if(s[x]=='R'&&a[2]){
				a[2]=false;		
			bfs(x+1);
			a[2]=true;
			 	t++;	bfs(x+1);
			 	t--;
			 }
		if(s[x]=='U'&&a[3]){
			a[3]=false;
						
			bfs(x+1);
			a[3]=true;
			 	t1++;
			 		bfs(x+1);
			 		t1--;
			 }
			if(s[x]=='D'&&a[4]){
				a[4]=false;
							
			bfs(x+1);
			a[4]=true;
			 	t1--;
			 	bfs(x+1);
			 	t1++;
			 }

	}
int main(){
	cin>>n;
	cin>>s;
	q.push_back({0,0});
	ji.insert({0,0});
	memset(a,true,sizeof(a));
	bfs(0);
	cout<<ji.size()<<endl; 
 for (const auto& coord : ji) {
        cout << coord.first << " " << coord.second<<endl;
    }
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

input:

2
RU

output:

4
0 0
0 1
1 0
1 1

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3764kb

input:

4
LRUD

output:

9
-1 -1
-1 0
-1 1
0 -1
0 0
0 1
1 -1
1 0
1 1

result:

wrong answer 1st lines differ - expected: '4', found: '9'