QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#787682 | #9521. Giving Directions in Harbin | CSQ# | WA | 0ms | 3580kb | C++17 | 687b | 2024-11-27 14:01:23 | 2024-11-27 14:01:24 |
Judging History
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)