QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693636#9521. Giving Directions in HarbinYuLanWA 2ms3616kbC++201.2kb2024-10-31 16:30:062024-10-31 16:30:07

Judging History

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

  • [2024-10-31 16:30:07]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3616kb
  • [2024-10-31 16:30:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+10;
char path[20];
int num[20];
char s[100];
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin>>t;
    map<pair<char,char>,char> ma;
    ma[make_pair('E','S')] = 'R';
    ma[make_pair('E','N')] = 'L';
    ma[make_pair('N','W')] = 'L';
    ma[make_pair('N','E')] = 'R';
    ma[make_pair('W','N')] = 'R';
    ma[make_pair('W','E')] = 'L';
    ma[make_pair('S','W')] = 'R';
    ma[make_pair('S','E')] = 'L';
    while(t--)
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            char x;
            int b;
            cin>>path[i]>>num[i];
        }
        char begin = path[1];
        int index = 0;
        s[++index] = 'Z';
        for(int i=2;i<=n;i++)
        {
            s[++index] = ma[make_pair(path[i-1],path[i])];
            s[++index] = 'Z';
        }
        int now = 0;
        cout<<index<<" "<<begin<<endl;
        for(int i=1;i<=index;i++)
        {
            cout<<s[i];
            if(s[i]=='Z')
            {
                cout<<" "<<num[++now];
            }
            cout<<endl;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 2ms
memory: 3552kb

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

result:

wrong answer Token parameter [name=g] equals to "~", doesn't correspond to pattern "[ZLR]" (test case 1)