QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#720559 | #9521. Giving Directions in Harbin | zzfs# | WA | 0ms | 3500kb | C++14 | 1.1kb | 2024-11-07 13:17:40 | 2024-11-07 13:17:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
char a[] = {'E', 'S', 'W', 'N'};
void solve()
{
int n;
cin >> n;
char dir = 0;
list<pair<char, int>> res;
unordered_map<char, int> mp;
mp.insert({'E', 0});
mp.insert({'S', 1});
mp.insert({'W', 2});
mp.insert({'N', 3});
for (int i = 1; i <= n; i++)
{
char ch;
int x;
cin >> ch >> x;
if (dir == 0)
{
res.push_back({ch, x});
dir = ch;
}
else
{
if (a[(mp[ch] + 1 + 4) % 4] == ch)
{
res.push_back({'R', x});
}
else
{
res.push_back({'L', x});
}
}
}
cout << res.size() - 1 << ' ';
for (auto [dir, x] : res)
{
cout << dir << '\n';
cout << "Z " << x << '\n';
}
}
signed main()
{
cin.tie(0)->ios::sync_with_stdio(false);
int t = 1;
cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3500kb
input:
1 2 S 2 E 1
output:
1 S Z 2 L Z 1
result:
wrong answer Wrong destination (test case 1)