QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#572654#9350. Fixing BannersN_z_AC ✓38ms4848kbC++145.1kb2024-09-18 15:50:252024-09-18 15:50:25

Judging History

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

  • [2024-09-18 15:50:25]
  • 评测
  • 测评结果:AC
  • 用时:38ms
  • 内存:4848kb
  • [2024-09-18 15:50:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct time_helper
{
#ifdef LOCAL
	clock_t time_last;
#endif
	time_helper()
	{
#ifdef LOCAL
		time_last=clock();
#endif
	}
	void test()
	{
#ifdef LOCAL
		auto time_now=clock();
		std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;
		time_last=time_now;
#endif
	}
	~time_helper()
	{
		test();
	}
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
#define Setprecision 10
#define between '\n'
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(T x){for(auto &y:x)*this<<y<<between;*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-Setprecision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(T c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(std::string str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}

void solve();
main()
{
	int t=1;
	cin>>t;
	while(t--)solve();
}
void solve()
{
	vector<int>a(6);
	for(int x=0;x<6;x++)
	{
		string s;
		cin>>s;
		a[x]=((!!count(s.begin(),s.end(),'h'))<<5)+((!!count(s.begin(),s.end(),'a'))<<4)+((!!count(s.begin(),s.end(),'r'))<<3)+((!!count(s.begin(),s.end(),'b'))<<2)+((!!count(s.begin(),s.end(),'i'))<<1)+((!!count(s.begin(),s.end(),'n'))<<0);
	}
	for(int x=0;x<(1<<6);x++)
	{
		int s=0;
		for(int y=0;y<6;y++)
		if(x>>y&1)s|=a[y];
		if(__builtin_popcount(s)<__builtin_popcount(x)){cout<<"No"<<endl;return;}
	}
	cout<<"Yes"<<endl;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
welcome
toparticipate
inthe
ccpccontest
inharbin
inoctober
harvest
belong
ninja
reset
amazing
intriguing

output:

No
Yes

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 19ms
memory: 3744kb

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:

ok 50000 lines

Test #3:

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

input:

46400
qmcsjjknjvhfv
hnbul
nsnkqejawa
klkoaytykfhkfaqvxv
djqcmokv
xtzwoye
blmxpxgpmx
rqqca
j
zshflbdjsccxg
crzivheauq
uoshinevxqbbyfqdz
cirxjbhihcaorkur
kbnzxqfq
llmekjvhdldyva
wtjxb
eswthf
rcmzrfjoaj
vrvmk
fhqfu
tlessqmw
vi
gzyjwk
xyodo
qzwvuhvxabzyxdb
vhb
urprkoxfukz
fnuqu
zklzuqshoagqsxkjcmuj
cpza...

output:

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

result:

ok 46400 lines

Test #4:

score: 0
Accepted
time: 24ms
memory: 3744kb

input:

16799
qnirkhvdc
irjxeqoc
eojfaoxqhwsjksqu
ttquucbewrvjlqeqdbdholwu
lmgxyknn
xotixvxrmmadrgsbcwzzuzafxwurahacrfdu
cjgmratfgjzyfksceqs
yuhyir
wrzyvilptvpmvsqkedivuzaqsoszmafcvdgutocixrv
dgefgjaf
tqiabsvnpzhsryva
ruzlibegdwgphsrrhqjrapvh
anwhzchedodtiigibhsq
lyonlnfujgktbzb
pkfcicbqkediphbw
ogmwdqq
eqo...

output:

Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes...

result:

ok 16799 lines

Test #5:

score: 0
Accepted
time: 38ms
memory: 3724kb

input:

50000
aaahrrr
n
ir
ia
arrr
innranirr
aaiii
iir
iiiirnnhn
bbb
rai
nb
nrb
rrn
baabb
birabarrna
aaaiinann
arnnbrrban
rrrbni
bbr
ir
bbari
briiianh
irrr
b
aini
iarr
aaaai
naraanri
i
rrbr
airbnbabh
hbbhhbb
hihrbrrih
bihrrrhrb
ar
inihnn
ib
n
hh
hiiini
haibbi
iihnihi
bih
bibhi
ihbahia
bn
iibhbiiinb
bhab
nbi...

output:

No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
No
No
No
Yes
Yes
No
No
No
Ye...

result:

ok 50000 lines

Test #6:

score: 0
Accepted
time: 31ms
memory: 3692kb

input:

25285
brrbinhrirnaabaa
ahbahnnrbnbnhar
arrhararrrarhrnraranhran
ararbrnbnhabna
nanaaarrhh
rrrbhrrr
bhhhhrbbh
hnhbbbbhrhrarrbbhbhbbbbhbrb
biribhharhrbbbibharbb
bhrbbbnr
bhhbihbbbrb
bhanh
anbhaaniaibbnibri
rhnninnaibhaaa
ibbri
abbibriannbibin
biinbabai
bnnrbnrrhihbiihiaibaibii
iannbbabihahibnnbbrn
nbb...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
...

result:

ok 25285 lines

Test #7:

score: 0
Accepted
time: 14ms
memory: 3748kb

input:

5588
nhhbhhhbbrhhbnbrrhrbhbnhnrhbbhhnbhnbhnhhbhrbhnnhrbbnrnnbhnrnbbhhhhnrrnnhn
brhbbnnhrbnrbrhbbhhhnrnrrnnhbnhrnnbnrrnnnrbrbrnnbnbnbrbbrbhnbrnhrhhnhrbbbhbrbbbhnrbrnhhbbnnnnhhrnhn
bbnbnbnbrhhnrrhbbhhbbbbnbbhhhhhrhbrbnhbbnbhbbbnhrnhrrbhhhbnnrnhnhrnhnbnnrbhhhn
hbhhbrbbbbbbbrhnbhbnnbnhbhrrnnrbnhnnbhhbhn...

output:

No
No
Yes
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
No
No
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
No
Yes
No
No
No
No
Yes
Yes
No
Yes
Yes
No
Yes
No
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
No
Yes
No
Yes
...

result:

ok 5588 lines

Test #8:

score: 0
Accepted
time: 12ms
memory: 3652kb

input:

129
inaaiannnbnibanaannibnabbanaaibinbbiibaibbbinaabiainnanaiinbbanbaaannnniannaaibnnbnnaaabnnbibnaibiannbaiiaaanbiaanibbibbanbaaninaniabiabibibbaabiaaaiiiabaaiiabiabiabbnnananinabnnnnbbibanniibaaaianininnbiinnbbninanibnnbannabbainbbinaibinbannainiaibnannnnbbbbinnaiibabbanbniiibbnanbbnabnnaiibiabinb...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
No
No
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
No
No
N...

result:

ok 129 lines

Test #9:

score: 0
Accepted
time: 12ms
memory: 3952kb

input:

61
irnnnrrnrrrrnrnrnnirrnininrniirrrrnrrirhnrnririnniiinnnnriariinrrrrrirnrnnrrrrrrrriirnnrrnrrrrrnirnaihnnranrnnniirninninrrihininnninnninrirrnrrnririnrnnnrirrinnarrinannninrnrrninrnrbnnriirnnibinnnirrrrnirririrrrinrnbnnrnnrnrninrranrnrbnirnaiirinnnnnnnrrrrinirnniarnrrrrnrirrnrrnirrnrrninrnrrnnhnna...

output:

Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
No
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 61 lines

Test #10:

score: 0
Accepted
time: 13ms
memory: 4724kb

input:

13
cweiayuxohsmbxvfpdnybebtylugrhlmqatwkthgeuscafhzihzehsnxkavzcvvwctferlinigkugjdsqirpghlcdnsdejkscnltwenhgwkiyvfenrwscpdinbhknpabvfaaevveoikkgntndtfgemlwgjzknjmyxvuvxslafuadslrsbnevnqmzfftqwdjwaxznnmxmfqjzrxraupzansxfvxexjebqhypcrwphlgewyhdhprtkirsywimvvueqnjvscytbecblomknyqphcztrqpfengnnstsmesjkm...

output:

Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
No
No

result:

ok 13 lines

Test #11:

score: 0
Accepted
time: 13ms
memory: 4848kb

input:

8
ribiirrbribiiriiriibrrbrnrbbbiibrbnnirribbnriiibrrbbrrinniiribrrirbiirbiiribrrrribbrbiribrniririrbriibiiiirbbnriibirbibbribbiibrbbbbirribrrbirrirbibbirbbirniriiribbirbrbirbrirbbrbbibbbbrbirriibbriiiinninbnbnibbinrbinnbirbriiibbbbbinrrbibribbnirrrrribbrrririibnnriirbibiibinrrbrirrbrriiiiibrnrrbrbrr...

output:

No
Yes
No
Yes
Yes
No
No
No

result:

ok 8 lines

Extra Test:

score: 0
Extra Test Passed