QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783404 | #9521. Giving Directions in Harbin | Zpair# | WA | 0ms | 3884kb | C++20 | 722b | 2024-11-26 09:37:17 | 2024-11-26 09:37:18 |
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 N\n",m);
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: 3884kb
input:
1 2 S 2 E 1
output:
2 N L Z 1
result:
wrong answer Should start with `Z` (test case 1)