QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#714905#9521. Giving Directions in Harbinljljljlj#RE 0ms0kbC++203.2kb2024-11-06 09:07:112024-11-06 09:07:12

Judging History

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

  • [2024-11-06 09:07:12]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-06 09:07:11]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
using i64 = long long;
const int inf = 1e18;

// pair<int, int> dir = {}

inline pair<int, int> dir(char ch)
{
    if (ch == 'N')
        return make_pair(0, 1);
    else if (ch == 'S')
        return make_pair(0, -1);
    else if (ch == 'W')
        return make_pair(-1, 0);
    else
        return make_pair(1, 0);
}

map<pair<char, char>, char> mp;

void solve()
{
    int n;
    cin >> n;
    pair<int, int> pos = {0, 0};
    vector<pair<char, int>> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].first >> a[i].second;
        // auto [dx, dy] = dir(ch);
        // pos.first += dx * step, pos.second += dy * step;
    }

    cout << (n * 2 - 1) << " " << a[1].first << endl;
    cout << "Z " << a[1].second << endl;
    for (int i = 2; i <= n; i++)
    {
        cout << mp[make_pair(a[i - 1].first, a[i].first)] << endl;
        cout << "Z " << a[i].second << endl;
    }

    // if (pos.second == 0)
    // {
    //     if (pos.first != 0)
    //     {
    //         cout << "1 ";
    //         if (pos.first < 0)
    //         {
    //             cout << "W" << endl;
    //             cout << "Z " << abs(pos.first) << endl;
    //         }
    //         else if (pos.first > 0)
    //         {
    //             cout << "E" << endl;
    //             cout << "Z " << abs(pos.first) << endl;
    //         }
    //     }
    //     else
    //     {
    //         cout << "7 N" << endl;
    //         cout << "Z 1" << endl;
    //         cout << "L" << endl;
    //         cout << "Z 1" << endl;
    //         cout << "L" << endl;
    //         cout << "Z 1" << endl;
    //         cout << "L" << endl;
    //         cout << "Z 1" << endl;
    //     }
    // }
    // else
    // {
    //     if (pos.first > 0 && pos.second == 0)
    //     {
    //         cout << "1 N" << endl;
    //         cout << "Z " << pos.first << endl;
    //     }
    //     else if (pos.first < 0 && pos.second == 0)
    //     {
    //         cout << "1 S" << endl;
    //         cout << "Z " << abs(pos.first) << endl;
    //     }
    //     else if (pos.first != 0 && pos.second != 0)
    //     {
    //         cout << "3 ";
    //         if (pos.second > 0)
    //             cout << "N" << endl;
    //         else
    //             cout << "S" << endl;
    //         cout << "Z " << abs(pos.second) << endl;
    //         if (pos.second * pos.first > 0)
    //             cout << "R" << endl;
    //         else
    //             cout << "L" << endl;
    //         cout << "Z " << abs(pos.first) << endl;
    //     }
    // }
}

signed main()
{
    // ios::sync_with_stdio(false), cin.tie(0);
    int T = 1;
    cin >> T;
    mp[make_pair('S', 'E')] = 'L';
    mp[make_pair('S', 'W')] = 'R';
    mp[make_pair('N', 'E')] = 'R';
    mp[make_pair('N', 'W')] = 'L';
    mp[make_pair('E', 'N')] = 'L';
    mp[make_pair('E', 'S')] = 'R';
    mp[make_pair('W', 'N')] = 'R';
    mp[make_pair('W', 'S')] = 'L';
    while (T--)
        solve();
    system("pause");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

1
2
S 2
E 1

output:


result: