QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#327044 | #3827. Alan Turing | writingdog# | WA | 2ms | 3696kb | C++20 | 2.1kb | 2024-02-14 18:22:47 | 2024-02-14 18:22:49 |
Judging History
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'