QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#701072#9521. Giving Directions in Harbinklhwong#WA 0ms3696kbC++171.1kb2024-11-02 13:43:262024-11-02 13:43:27

Judging History

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

  • [2024-11-02 13:43:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3696kb
  • [2024-11-02 13:43:26]
  • 提交

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)