QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783403 | #9521. Giving Directions in Harbin | Zpair# | WA | 0ms | 3904kb | C++20 | 725b | 2024-11-26 09:36:37 | 2024-11-26 09:36:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int calc(char c){
if(c=='N')return 0;
if(c=='E')return 1;
if(c=='S')return 2;
if(c=='W')return 3;
}
int op[100],v[100],m;
void solve(){
scanf("%d",&n);
int lst=0;
for(int i=1;i<=n;++i){
char s[10];
int x;
scanf("%s%d",s,&x);
int t=calc(s[0]);
if(t==lst)
op[++m]=1,v[m]=x;
else if((lst+1)%4==t){
op[++m]=2;
op[++m]=1,v[m]=x;
}
else if((lst+3)%4==t){
op[++m]=3;
op[++m]=1,v[m]=x;
}
lst=t;
}
printf("%d %d\n",m,0);
for(int i=1;i<=m;++i){
if(op[i]==1)printf("Z %d\n",v[i]);
else if(op[i]==2)printf("R\n");
else printf("L\n");
}
m=0;
}
int main(){
int T;cin>>T;
while(T--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3904kb
input:
1 2 S 2 E 1
output:
2 0 L Z 1
result:
wrong answer Token parameter [name=f] equals to "0", doesn't correspond to pattern "[NSWE]" (test case 1)