QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#708836 | #9521. Giving Directions in Harbin | qzez# | WA | 0ms | 4076kb | C++14 | 582b | 2024-11-04 08:27:10 | 2024-11-04 08:27:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int T,n;
char dir[5]="NWSE";
int trans(char c){
return find(dir,dir+4,c)-dir;
}
void work(){
scanf("%d",&n);
int cur=0;
vector<pair<char,int>>ans;
for(;n--;){
char str[9];
int x;
scanf("%s%d",str,&x);
int p=trans(*str);
for(;cur!=p;)ans.push_back({'L',0}),(cur+=1)%=4;
ans.push_back({'Z',x});
}
printf("%ld N\n",ans.size());
for(auto [x,y]:ans){
if(x=='Z')printf("%c %d\n",x,y);
else printf("%c\n",x);
}
}
int main(){
for(scanf("%d",&T);T--;)work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4076kb
input:
1 2 S 2 E 1
output:
5 N L L Z 2 L Z 1
result:
wrong answer Should start with `Z` (test case 1)