QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#327044#3827. Alan Turingwritingdog#WA 2ms3696kbC++202.1kb2024-02-14 18:22:472024-02-14 18:22:49

Judging History

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

  • [2024-02-14 18:22:49]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3696kb
  • [2024-02-14 18:22:47]
  • 提交

answer

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

// #define int long long
#define endl '\n'
typedef unsigned long long ull;

const int N = 1e5;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
    int n;
    scanf("%d", &n);
   // cout << n << endl;
    char x;
    scanf("%c", &x);
    // cin >> n;
    vector<vector<array<int, 3>>> v(n + 1, vector<array<int, 3>>(3));
    for (int i = 1; i < n; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            scanf("(%d, %d, %d)", &v[i][j][0], &v[i][j][1], &v[i][j][2]);
            char x;
            scanf("%c", &x);
           //  cout << v[i][j][0] << " " << v[i][j][2] << endl;
            // cout << ","<< x <<"," <<endl;
        }
        // char x;
        // scanf("%c",&x);
    }
    int m;
    scanf("%d", &m);
   // cout << m << endl;
    while (m--)
    {
        int x;
        scanf("%d", &x);
        unordered_map <int,int> t;
        for (int i = 1; i <= x; ++i)
        {
            int tmp;

            scanf("%d", &tmp);
             t[i]=tmp;
            //cout << t[i] << " ";
        }
        //cout << endl;
        char tmp;
        scanf("%c",&tmp);
        int now = 1;
        int st = 1;
        int ok = 0;
        for (int c = 1; c <= 10; ++c)
        {
            int input;
            if (t.find(now)!=t.end())
                input = t[now];
             else
                 input= t[now] = 2;
            t[now] = v[st][input][2];
            now += v[st][input][1];
            st = v[st][input][0];
            if (st == n)
            {
                cout << "yes\n";
                ok = 1;
                break;
            }
        }
        if (!ok)
        {
            cout << "no\n";
        }
    }
}

signed main()
{
    // cout.flags(ios::fixed); cout.precision(8);
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout.tie(0);

    int T = 1;
    scanf("%d", &T);
    // cin >> T;
    for (int i = 1; i <= T; ++i)
    {
        cout << "Machine #" << i << ":\n";
        solve();
    }
    return 0;
}
/*

*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3696kb

input:

20
1
98
9 1 1 1 0 0 1 0 0 1
5 0 0 0 0 0
6 0 0 1 1 0 1
5 1 0 1 1 0
9 1 1 1 1 1 0 0 1 0
10 0 1 1 1 1 1 0 1 1 1
5 0 1 1 1 1
7 1 1 0 1 1 1 0
6 1 0 1 1 0 0
9 1 1 0 0 0 1 1 1 0
7 0 0 0 1 1 1 0
7 1 0 1 0 1 0 1
9 0 0 1 0 1 1 1 1 1
9 1 0 1 1 0 1 1 1 0
8 0 1 1 0 1 0 0 1
6 0 0 1 0 0 0
10 1 0 1 0 0 0 0 0 1 1
10...

output:

Machine #1:
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
no
...

result:

wrong answer 2nd lines differ - expected: 'yes', found: 'no'