QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#787688#9521. Giving Directions in HarbinCSQ#WA 0ms3812kbC++17687b2024-11-27 14:02:182024-11-27 14:02:20

Judging History

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

  • [2024-11-27 14:02:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3812kb
  • [2024-11-27 14:02:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
char dir[4] = {'N','E','S','W'};
int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int cur = 0;
        vector<array<int,2>>ans;
        for(int i=0;i<n;i++){
            char d;
            cin>>d;
            int x;
            cin>>x;
            while(d != dir[cur]){
                ans.push_back({-1,-1});
                cur = (cur+1)%4;
            }
            ans.push_back({cur,x});
        }
        cout<<ans.size()<<" N"<<'\n';
        for(auto [x,y]:ans){
            if(x == -1)cout<<"R"<<'\n';
            else cout<<"Z "<<y<<'\n';
        }
    }


}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2
S 2
E 1

output:

7 N
R
R
Z 2
R
R
R
Z 1

result:

wrong answer Should start with `Z` (test case 1)