QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#787682#9521. Giving Directions in HarbinCSQ#WA 0ms3580kbC++17687b2024-11-27 14:01:232024-11-27 14:01:24

Judging History

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

  • [2024-11-27 14:01:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-11-27 14:01:23]
  • 提交

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()<<" S"<<'\n';
        for(auto [x,y]:ans){
            if(x == -1)cout<<"R"<<'\n';
            else cout<<"Z "<<y<<'\n';
        }
    }


}

詳細信息

Test #1:

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

input:

1
2
S 2
E 1

output:

7 S
R
R
Z 2
R
R
R
Z 1

result:

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