QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692788#5416. Fabulous Fungus Frenzyxiey#WA 0ms3656kbC++202.5kb2024-10-31 15:02:502024-10-31 15:02:50

Judging History

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

  • [2024-10-31 15:02:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-10-31 15:02:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define ll long long
#define ull unsigned long long

const int MOD = 1e9 + 7;
const int N = 3005;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        char c;
        int b;
        int x = 0, y = 0;
        for (int i = 0; i < n; i++)
        {
            cin >> c >> b;
            if (c == 'N')
            {
                y += b;
            }
            if (c == 'S')
            {
                y -= b;
            }
            if (c == 'E')
            {
                x += b;
            }
            if (c == 'W')
            {
                x -= b;
            }
        }
        if (x > 0)
        {
            if (y == 0)
            {
                cout << 1 << " E" << endl;
                cout << "Z" << " " << x << endl;
            }
            else
            {
                cout << 3 << " E" << endl;
                cout << "Z" << " " << x << endl;
                if (y > 0)
                    cout << "L" << endl;
                else
                    cout << "R" << endl;
                cout << "Z" << " " << abs(y) << endl;
            }
        }
        else if (x < 0)
        {
            if (y == 0)
            {
                cout << 1 << " W" << endl;
                cout << "Z" << " " << -x << endl;
            }
            else
            {
                cout << 3 << " W" << endl;
                cout << "Z" << " " << -x << endl;
                if (y > 0)
                    cout << "R" << endl;
                else
                    cout << "L" << endl;
                cout << "Z" << " " << abs(y) << endl;
            }
        }
        else if (x == 0)
        {
            if (y == 0)
            {
                cout << 7 << " E" << 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 (y > 0)
                    cout << 1 << " N" << endl;
                else
                    cout << 1 << " S" << endl;
                cout << "Z" << " " << abs(y) << endl;
            }
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3 1
OOO
GOG
BGB

OOO
GGG
BBB

3 1
B
G
B

output:

7 E
Z 1
L
Z 1
L
Z 1
L
Z 1
7 E
Z 1
L
Z 1
L
Z 1
L
Z 1
7 E
Z 1
L
Z 1
L
Z 1
L
Z 1

result:

wrong output format Expected integer, but "E" found