QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#460924 | #4192. Index Case | ZhouShang | RE | 1ms | 3740kb | C++20 | 1.2kb | 2024-07-02 13:32:31 | 2024-07-02 13:32:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define rep(i,a,b) for (int i = a; i < (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back
#define FS first
#define SD second
#define ary(k) array<int, k>
template<class A, class B> void cmx(A &x, B y) { x = max<A>(x, y);}
template<class A, class B> void cmn(A &x, B y) { x = min<A>(x, y);}
typedef pair<int, int> pii;
typedef vector<int> vi;
int n,m,g[20][20][20],f[209][11][11],b[209];
void C(int p,int q){
memset(f,0,sizeof f),f[2][p][q]=1;
for(int i=3;i<=n;i++)
for(int j=1;j<=m;j++)
for(int k=1;k<=m;k++)
for(int l=1;l<=m;l++)
if(f[i-1][j][k]&&g[j][k][l]==b[i-1])
f[i][k][l]=1;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(f[n][i][j]&&g[i][j][p]==b[n]&&g[j][p][q]==b[1])
cout<<"yes\n",exit(0);
}
signed main() {
//cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit);
cin>>n>>m;
for(int i=1;i<=m;i++)
for(int j=1;j<=m;j++)
for(int k=1;k<=m;k++)
cin>>g[i][j][k];
for(int i=1;i<=n;i++)
cin>>b[i];
for(int i=1;i<=m;i++)
for(int j=1;j<=m;j++)
C(i,j);
cout<<"no\n";
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3740kb
input:
4 2 1 2 1 2 2 1 2 1 1 2 1 2
output:
yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
6 2 1 2 1 2 2 1 2 1 1 2 1 2 1 2
output:
no
result:
ok answer is NO
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
10 2 1 2 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 2
output:
yes
result:
ok answer is YES
Test #4:
score: -100
Runtime Error
input:
200 10 1 7 8 5 5 3 7 5 7 4 1 10 10 4 1 2 7 7 9 4 8 7 2 7 7 5 8 6 2 4 4 10 10 10 9 8 6 5 5 8 8 1 1 8 9 5 9 4 6 9 1 6 4 1 1 10 5 2 4 4 3 10 6 9 3 2 4 2 10 10 10 6 8 4 10 9 8 7 2 9 3 7 4 8 6 3 9 9 1 3 10 2 6 10 1 1 3 3 2 1 5 9 9 10 7 8 5 5 10 1 5 8 7 2 9 8 7 1 8 6 7 8 7 2 10 1 1 1 2 7 7 9 9 9 7 5 4 3 4...