QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#573126#9350. Fixing BannerswhyhereTL 0ms3640kbC++171.1kb2024-09-18 17:27:432024-09-18 17:27:43

Judging History

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

  • [2024-09-18 17:27:43]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3640kb
  • [2024-09-18 17:27:43]
  • 提交

answer

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

void Z()
{
    vector<string> a(6);
    string s = "harbin";
    for (int i = 0; i < 6; i++)
    {
        cin >> a[i];
    }
    vector<vector<int>> st(6,vector<int> (6,0));
    bool flag = 0;
    do
    {
        int cnt = 0;
        for (int i = 0; i < 6; i++)
        {
            for (int j = 0; j < a[i].size(); j++)
            {
               
                if (st[i][i] == 1)
                {
                    cnt ++;
                    break;
                }
                
                if (a[i][j] == s[i])
                {
                    cnt++;
                    st[i][i] = 1;
                    break;
                }
            }
        }
        if (cnt == 6)
        {
            cout << "Yes\n";
            return;
        }
    } while (next_permutation(a.begin(), a.end()));
   
    cout << "No\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t;
    while (t--)
    {
        Z();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

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
Time Limit Exceeded

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
Yes
Yes
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...

result: