QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#509080 | #7516. Robot Experiment | clocky# | WA | 0ms | 3764kb | C++14 | 1.1kb | 2024-08-08 09:36:28 | 2024-08-08 09:36:28 |
Judging History
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'