QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#697483#9521. Giving Directions in Harbinjimmyywang#WA 0ms3620kbC++141.0kb2024-11-01 14:20:192024-11-01 14:20:20

Judging History

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

  • [2024-11-01 14:20:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-11-01 14:20:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;i++)
ll rd(){
    ll x=0,f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
    while(isdigit(c)){x=x*10+c-'0';c=getchar();}
    return x*f;
}
#define d rd()
ll T,n;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
map<char,ll>mp;
char f[1000010];
char res[100010];
ll t[100010];
int main(){
    mp['E']=0;mp['S']=1,mp['W']=2,mp['N']=3;
    T=d;while(T--){
        n=d;ll m=0;char C;
        f(i,1,n){
            cin>>f[i];ll x=d;
            if(i==1){C=f[1],res[++m]='Z',t[m]=x;continue;}
            else{
                ll o=mp[f[i-1]],p=mp[f[i]];
                while(1){
                    if(o==p)break;
                    o=(o+1)%4;
                    res[++m]='R';
                }
                res[++m]='Z',t[m]=x;
            }
        }cout<<m<<" "<<C<<endl;
        f(i,1,m){
            if(res[i]=='R')cout<<'R'<<endl;
            else cout<<"Z"<<" "<<t[i]<<endl;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

input:

1
2
S 2
E 1

output:

5 S
Z 2
R
R
R
Z 1

result:

wrong answer Same direction appears twice (test case 1)