QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#607343#9350. Fixing Bannerscatwine#TL 1ms3736kbC++141.3kb2024-10-03 14:45:532024-10-03 14:45:58

Judging History

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

  • [2024-10-03 14:45:58]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3736kb
  • [2024-10-03 14:45:53]
  • 提交

answer

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

#define int long long
#define endl '\n'

#ifdef DEBUG
#define debug(x) cerr << #x << ": " << x << endl;
#else
#define debug(x)
#endif

int n, m, t;
vector<string> s(6);
int val[6][6];

void solve() {
  memset(val, 0, sizeof val);
  for (int i = 0; i < 6; ++i) {
    cin >> s[i];
    for (char &ch : s[i]) {
      if (ch == 'h') {
        val[i][0] = 1;
      } else if (ch == 'a') {
        val[i][1] = 1;
      } else if (ch == 'r') {
        val[i][2] = 1;
      } else if (ch == 'b') {
        val[i][3] = 1;
      } else if (ch == 'i') {
        val[i][4] = 1;
      } else if (ch == 'n') {
        val[i][5] = 1;
      }
    }
  }

  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      cerr << val[i][j] << ' ';
    }
    cerr << endl;
  }
  cerr << endl;
  int ord[6] = {0, 1, 2, 3, 4, 5}, flag = 1;
  do {
    flag = 1;
    for (int i = 0; i < 6; ++i) {
      if (val[ord[i]][i] != 1) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      cout << "Yes\n";
      return;
    }
  } while (next_permutation(ord, ord + 6));
  cout << "No\n";
  return;
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0), cerr.tie(0);

  cin >> t;
  while (t--)
    solve();
}


详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3736kb

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

result: