QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#704274#9521. Giving Directions in Harbinadivse#WA 3ms3568kbC++202.2kb2024-11-02 19:39:342024-11-02 19:39:34

Judging History

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

  • [2024-11-02 19:39:34]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3568kb
  • [2024-11-02 19:39:34]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#define endl '\n'
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define rep2(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
template<typename T>
void cc(vector<T> tem) { for (auto x : tem) cout << x << ' '; cout << endl; }
void cc(int a) { cout << a << endl; }
void cc(int a, int b) { cout << a << ' ' << b << endl; }
void cc(int a, int b, int c) { cout << a << ' ' << b << ' ' << c << endl; }
void kuaidu() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); }
inline int max(int a, int b) { if (a < b) return b; return a; }
inline int min(int a, int b) { if (a < b) return a; return b; }
void cmax(int& a, const int b) { if (b > a) a = b; }
void cmin(int& a, const int b) { if (b < a) a = b; }
using PII = pair<int, int>;
using i128 = __int128;

//--------------------------------------------------------------------------------
const int N = 1e5 + 10;
const int M = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 1e16;
int n, m, T;
vector<pair<char, int>> A;
map<char, int> mp;
//--------------------------------------------------------------------------------

signed main() {
    kuaidu();
    T = 1;
    mp['S'] = 2;
    mp['E'] = 3;
    mp['W'] = 1;
    mp['N'] = 0;
    cin >> T;
    while (T--) {
        cin >> n;
        rep(i, 1, n) {
            char a; int b; cin >> a >> b;
            A.push_back({ a,b });
        }
        int fl = 0;//0 shang 1 zuo 2 xia 3 you
        fl = mp[A[0].first];
        vector<pair<char, int>> B;
        for (auto [a, b] : A) {
            while (fl != mp[a]) {
                fl++;
                fl %= 4;
                B.push_back({ 'L',0 });
            }
            B.push_back({ 'Z',b });
        }
        // cout << B.size() << " " << 'N' << endl;
        cout << B.size() << " ";
        cout << A[0].first << endl;
        // if ()
        for (auto [a, b] : B) {
            if (b == 0) cout << a << endl;
            else {
                cout << a << " " << b << endl;
            }
        }

    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3536kb

input:

1
2
S 2
E 1

output:

3 S
Z 2
L
Z 1

result:

ok ok (1 test case)

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3568kb

input:

99
4
E 6
N 1
W 2
S 8
8
W 10
N 1
E 10
S 2
E 2
N 2
W 2
S 1
9
N 5
E 4
N 7
E 6
S 9
E 8
N 4
W 6
N 7
6
N 6
E 6
N 8
W 9
S 7
E 2
8
E 6
S 9
W 5
S 4
W 6
N 4
E 5
N 9
8
N 6
W 10
N 6
W 6
S 6
E 6
S 6
E 10
10
N 7
W 3
N 5
W 5
S 8
W 10
N 6
E 9
N 8
E 8
8
W 9
N 10
E 6
S 10
E 9
S 10
W 6
N 10
4
W 5
N 1
E 5
S 1
4
W 4
S 8...

output:

7 E
Z 6
L
Z 1
L
Z 2
L
Z 8
31 E
Z 6
L
Z 1
L
Z 2
L
Z 8
L
L
L
Z 10
L
L
L
Z 1
L
L
L
Z 10
L
L
L
Z 2
L
Z 2
L
Z 2
L
Z 2
L
Z 1
58 E
Z 6
L
Z 1
L
Z 2
L
Z 8
L
L
L
Z 10
L
L
L
Z 1
L
L
L
Z 10
L
L
L
Z 2
L
Z 2
L
Z 2
L
Z 2
L
Z 1
L
L
Z 5
L
L
L
Z 4
L
Z 7
L
L
L
Z 6
L
L
L
Z 9
L
Z 8
L
Z 4
L
Z 6
L
L
L
Z 7
71 E
Z 6
L
Z 1
L...

result:

wrong answer Integer parameter [name=m] equals to 31, violates the range [1, 20] (test case 2)