QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#701072 | #9521. Giving Directions in Harbin | klhwong# | WA | 0ms | 3696kb | C++17 | 1.1kb | 2024-11-02 13:43:26 | 2024-11-02 13:43:27 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int t{};
int n{}, x{};
char d{};
int getDir(char c) {
if (c == 'N') {
return 0;
} else if (c == 'E') {
return 1;
} else if (c == 'S') {
return 2;
} else {
return 3;
}
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> t;
while(t--) {
cin >> n;
vector<pair<char, int>> answer;
int prevDir, curDir;
for (int i = 0; i < n; i++) {
cin >> d >> x;
curDir = getDir(d);
if (i == 0) {
cout << (n - 1) * 2 + 1 << ' ' << curDir << '\n';
cout << 'Z' << ' ' << x << '\n';
} else {
if (curDir == (prevDir + 1) % 4) {
cout << 'R' << '\n';
cout << 'Z' << ' ' << x << '\n';
} else {
cout << 'L' << '\n';
cout << 'Z' << ' ' << x << '\n';
}
}
prevDir = curDir;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3696kb
input:
1 2 S 2 E 1
output:
3 2 Z 2 L Z 1
result:
wrong answer Token parameter [name=f] equals to "2", doesn't correspond to pattern "[NSWE]" (test case 1)