QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#642598 | #9350. Fixing Banners | planckconstant# | WA | 182ms | 3604kb | C++14 | 1.4kb | 2024-10-15 15:11:59 | 2024-10-15 15:12:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
int trans(char c)
{
if(c=='h'){
return 0;
}
if(c=='a'){
return 1;
}
if(c=='r'){
return 2;
}
if(c=='b'){
return 3;
}
if(c=='i'){
return 4;
}
if(c=='n'){
return 5;
}
return -1;
}
void solve()
{
vector<string>a(6);
vector<vector<bool>>b(6,vector<bool>(6));
for(int i=0;i<6;i++){
cin>>a[i];
}
for(int i=0;i<6;i++){
for(int j=0;j<a[i].size();j++){
int k=trans(a[i][j]);
if(k>=0){
b[i][k]=1;
}
}
}
vector<int>c(6);
for(int i=0;i<6;i++){
c[i]=i;
}
bool ok=0;
auto dfs1=[&b,&c,&ok](auto&&self,int deep){
if(deep==6){
for(int i=0;i<6;i++){
if(!b[i][c[i]]){
return;
}
}
ok=1;
return;
}
for(int i=deep;i<6;i++){
swap(c[deep],c[i]);
self(self,deep+1);
}
};
dfs1(dfs1,0);
if(ok){
cout<<"Yes"<<'\n';
}
else{
cout<<"No"<<'\n';
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T=1;
cin >> T;
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3604kb
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: 182ms
memory: 3540kb
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 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 19th lines differ - expected: 'Yes', found: 'No'