QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#704249#9521. Giving Directions in Harbinadivse#WA 0ms3596kbC++202.1kb2024-11-02 19:35:592024-11-02 19:36:00

Judging History

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

  • [2024-11-02 19:36:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-11-02 19:35:59]
  • 提交

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
        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;
        for (auto [a, b] : B) {
            if (b == 0) cout << a << endl;
            else {
                cout << a << " " << b << endl;
            }
        }

    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3596kb

input:

1
2
S 2
E 1

output:

5 N
L
L
Z 2
L
Z 1

result:

wrong answer Should start with `Z` (test case 1)