QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#787688 | #9521. Giving Directions in Harbin | CSQ# | WA | 0ms | 3812kb | C++17 | 687b | 2024-11-27 14:02:18 | 2024-11-27 14:02:20 |
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()<<" 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)