QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595707 | #9350. Fixing Banners | yeah14 | WA | 62ms | 3648kb | C++17 | 1.9kb | 2024-09-28 14:18:30 | 2024-09-28 14:18:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull long long
#define PII pair<int ,int>
const int INF = -1145141919810;
const int mod = 1e9 + 7;
const int N = 1e7;
int a[N];
string s[6];
int vis[6][6];
int viss[6];
bool visss[6];
string t = "harbin";
bool op = 0;
int st[7], top = 0;
//harbin;0 h;1,a;2 r;3 b;4 i;5 n
void dfs(int x) {
if (x >= 5&&op==0&&top==6) {
/*for (int i = top - 1; i >= 0; i--) {
cout << st[i] << " ";
}
cout << endl;*/
op = 1;
}
if (op == 1)return;
for (int i = 0; i < 6; i++) {
if (viss[i])continue;
if (vis[x][i]) {
viss[i] = 1;
for (int j = 0; j < 6; j++) {
if (visss[j])continue;
st[top++] = j;
visss[j] = 1;
dfs(j);
if (op == 1)return;
visss[j] = 0;
top--;
}
viss[i] = 0;
}
}
}
void solve() {
op = 0;
memset(vis, 0, sizeof(vis));
for (int i = 0; i < 6; i++) {
cin >> s[i];
for (int j = 0; j < s[i].length(); j++) {
for (int k = 0; k < 6; k++) {
if (s[i][j] == t[k]) {
vis[i][k] = 1;
break;
}
}
}
}
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
if (vis[i][j])break;
cout << "No" << endl;
return;
}
visss[i] = 1;
st[top++] = i;
dfs(i);
visss[i] = 0;
top--;
if (op == 1)break;
}
if (!op)cout << "No" << endl;
else cout << "Yes" << endl;
}
//&&(((sum[n]+k)%mid==0)||(sum[n]/mid!=(sum[n]+k)/mid)||(mid-(sum[n]%mid)>=k))
signed main() {
int t=1;
cin >> t;
//t = 1;
//er(9e6);
while (t--)solve();
}
//int n;
//cin >> n;
//for (int i = 1; i <= n; i++) {
// cin >> a[i];
//}
//int maxx = 0, minn = INF;
//int sum = 0;
//for (int i = n; i <= 1; i++) {
// sum += minn;
// if (top == 0) {
// minn = a[i];
// st[top++] = a[i];
// }
// else {
// if (a[i] > top && a[i] > minn)
// }
//}
//cout << maxx - minn << endl;
//7 2 1 4 5 1 3 3
//4 1000 1000 1000 1000
//0
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
2 welcome toparticipate inthe ccpccontest inharbin inoctober harvest belong ninja reset amazing intriguing
output:
No Yes
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 62ms
memory: 3648kb
input:
50000 dwwfplbjd elulqfmsp whobggs kbnhtvzcs zllux ggye vtnqpmvi cgsplau gkuwhhmrio sp q utrefny tvdcequdjj klesyx esovlmdy x nywu gklfbqfb ysnaswszfq ouo tq r auvi copeabvz nruvawao cdv vdsk hboecpit s ewscbmb jeqp gel u htk fcoigxbux ylinyzut bnhrvoetf xa ehnbce keyk efvzoyba xan tvnlm tetpijfh blq...
output:
No No No No No No No No No No No No No No No Yes 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 16th lines differ - expected: 'No', found: 'Yes'