QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#578434 | #9350. Fixing Banners | psycho# | TL | 1ms | 3560kb | C++20 | 1.1kb | 2024-09-20 19:11:28 | 2024-09-20 19:11:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define vc vector
#define pii pair <int, int>
#define int long long
using ld = long double;
using ll = long long;
const int inf = 1e9;
template<class T>
bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T>
bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
string w = "harbin";
void solve_case() {
vector<string> a(6);
for (auto &i : a) cin >> i;
vector<vector<bool>> ok(6, vector<bool>(26));
for (int i = 0; i < 6; ++i) {
for (auto &x : a[i]) ok[i][x - 'a'] = 1;
}
sort(ok.begin(), ok.end());
bool s = false;
do {
bool q = true;
for (int i = 0; i < 6; ++i) {
if (!ok[i][w[i] - 'a']) q = false;
}
s |= q;
} while (next_permutation(ok.begin(), ok.end()));
cout << (s ? "Yes" : "No") << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin >> T;
while (T--) solve_case();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
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...