QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#230242#7635. Fairy Chessucup-team191#AC ✓1106ms112572kbC++141.9kb2023-10-28 17:56:452023-10-28 17:56:53

Judging History

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

  • [2023-10-28 17:56:53]
  • 评测
  • 测评结果:AC
  • 用时:1106ms
  • 内存:112572kb
  • [2023-10-28 17:56:45]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using pii=pair<int,int>;
using vi=vector<int>;
using ll=long long;
using ull=unsigned long long;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=310,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int n;
string s;
ull bi[N][N];
map<pair<ull,ull>,bool> mem[N];
int st;

bool pob(int i,ull ma,ull uz)
{
	if (ma+1==0) return 0;
	if (mem[i].find({ma,uz})!=mem[i].end()) return mem[i][{ma,uz}];
	++st;
	for (int p=0;p<64;++p) if (((ma>>p)&1)==0 && (bi[s[i]][p]&uz)==0 && pob(i+1,ma|bi[s[i]][p],uz|(1ull<<p))==0) return mem[i][{ma,uz}]=1;
	return mem[i][{ma,uz}]=0;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	for (int i=0;i<8;++i) for (int j=0;j<8;++j)
	{
		for (int i1=0;i1<8;++i1) for (int j1=0;j1<8;++j1)
		{
			if (i1+j1==i+j || i1-j1==i-j)
			{
				bi['B'][i*8+j]|=1ull<<(i1*8+j1);
				bi['A'][i*8+j]|=1ull<<(i1*8+j1);
				bi['Q'][i*8+j]|=1ull<<(i1*8+j1);
				bi['M'][i*8+j]|=1ull<<(i1*8+j1);
			}
			if (i1==i || j1==j)
			{
				bi['Q'][i*8+j]|=1ull<<(i1*8+j1);
				bi['M'][i*8+j]|=1ull<<(i1*8+j1);
				bi['R'][i*8+j]|=1ull<<(i1*8+j1);
				bi['C'][i*8+j]|=1ull<<(i1*8+j1);
			}
			int d1=abs(i1-i),d2=abs(j1-j);
			if ((d1==1 && d2==2) || (d1==2 && d2==1))
			{
				bi['A'][i*8+j]|=1ull<<(i1*8+j1);
				bi['M'][i*8+j]|=1ull<<(i1*8+j1);
				bi['C'][i*8+j]|=1ull<<(i1*8+j1);
				bi['K'][i*8+j]|=1ull<<(i1*8+j1);
			}
		}
	}
	/*ull re=bi['K'][18];
	for (int i=0;i<8;++i,cout<<en) for (int j=0;j<8;++j) cout<<((re>>(i*8+j))&1);
	cout<<en;
	re=bi['B'][18];
	for (int i=0;i<8;++i,cout<<en) for (int j=0;j<8;++j) cout<<((re>>(i*8+j))&1);
	cout<<en;
	re=bi['R'][18];
	for (int i=0;i<8;++i,cout<<en) for (int j=0;j<8;++j) cout<<((re>>(i*8+j))&1);*/
	if (pob(0,0,0)) cout<<"Alice\n";
	else cout<<"Bob\n";
	//cout<<st<<en;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 101ms
memory: 17920kb

input:

BBAARRCCQQMM

output:

Bob

result:

ok single line: 'Bob'

Test #2:

score: 0
Accepted
time: 6ms
memory: 4688kb

input:

BAMBAMQQRCCR

output:

Alice

result:

ok single line: 'Alice'

Test #3:

score: 0
Accepted
time: 3ms
memory: 4196kb

input:

QQRAACMRMCBB

output:

Alice

result:

ok single line: 'Alice'

Test #4:

score: 0
Accepted
time: 11ms
memory: 5712kb

input:

MBBARQRMACQC

output:

Alice

result:

ok single line: 'Alice'

Test #5:

score: 0
Accepted
time: 3ms
memory: 4120kb

input:

ACQCMQRBBRMA

output:

Alice

result:

ok single line: 'Alice'

Test #6:

score: 0
Accepted
time: 7ms
memory: 4944kb

input:

MRCMABRQCQAB

output:

Alice

result:

ok single line: 'Alice'

Test #7:

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

input:

BBRCMMQAAQRC

output:

Alice

result:

ok single line: 'Alice'

Test #8:

score: 0
Accepted
time: 10ms
memory: 5396kb

input:

RRMCQMACABQB

output:

Alice

result:

ok single line: 'Alice'

Test #9:

score: 0
Accepted
time: 7ms
memory: 5500kb

input:

QMQBMRBACACR

output:

Alice

result:

ok single line: 'Alice'

Test #10:

score: 0
Accepted
time: 6ms
memory: 4700kb

input:

CMRQAQCBBRAM

output:

Alice

result:

ok single line: 'Alice'

Test #11:

score: 0
Accepted
time: 8ms
memory: 6224kb

input:

CABCRQMMRQAB

output:

Alice

result:

ok single line: 'Alice'

Test #12:

score: 0
Accepted
time: 39ms
memory: 9908kb

input:

ARCBBCMQRAQM

output:

Alice

result:

ok single line: 'Alice'

Test #13:

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

input:

ARCMCARMQBBQ

output:

Alice

result:

ok single line: 'Alice'

Test #14:

score: 0
Accepted
time: 26ms
memory: 8004kb

input:

AQABMCQCMRRB

output:

Bob

result:

ok single line: 'Bob'

Test #15:

score: 0
Accepted
time: 3ms
memory: 4936kb

input:

ACMRABRQMCBQ

output:

Alice

result:

ok single line: 'Alice'

Test #16:

score: 0
Accepted
time: 30ms
memory: 9392kb

input:

CBARMBCQMQAR

output:

Bob

result:

ok single line: 'Bob'

Test #17:

score: 0
Accepted
time: 43ms
memory: 10020kb

input:

RBABRQMCAMQC

output:

Bob

result:

ok single line: 'Bob'

Test #18:

score: 0
Accepted
time: 2ms
memory: 4028kb

input:

MBCQBQARRMCA

output:

Alice

result:

ok single line: 'Alice'

Test #19:

score: 0
Accepted
time: 22ms
memory: 7412kb

input:

AMBQRBCQACMR

output:

Bob

result:

ok single line: 'Bob'

Test #20:

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

input:

QRAMQMBBCRAC

output:

Alice

result:

ok single line: 'Alice'

Test #21:

score: 0
Accepted
time: 5ms
memory: 4480kb

input:

ARBCQMMBARQC

output:

Alice

result:

ok single line: 'Alice'

Test #22:

score: 0
Accepted
time: 67ms
memory: 14512kb

input:

CACAMBRQQRBM

output:

Bob

result:

ok single line: 'Bob'

Test #23:

score: 0
Accepted
time: 26ms
memory: 7628kb

input:

CQRRMMBQABCA

output:

Bob

result:

ok single line: 'Bob'

Test #24:

score: 0
Accepted
time: 23ms
memory: 7384kb

input:

ABABCQRMMCRQ

output:

Alice

result:

ok single line: 'Alice'

Test #25:

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

input:

CMBRAAQRQMBC

output:

Bob

result:

ok single line: 'Bob'

Test #26:

score: 0
Accepted
time: 2ms
memory: 3972kb

input:

AQBMRMQRBACC

output:

Alice

result:

ok single line: 'Alice'

Test #27:

score: 0
Accepted
time: 18ms
memory: 6560kb

input:

BRACQQMCAMBR

output:

Bob

result:

ok single line: 'Bob'

Test #28:

score: 0
Accepted
time: 5ms
memory: 4740kb

input:

MCCAQBMQRABR

output:

Bob

result:

ok single line: 'Bob'

Test #29:

score: 0
Accepted
time: 37ms
memory: 9408kb

input:

RBQBCRAACMQM

output:

Bob

result:

ok single line: 'Bob'

Test #30:

score: 0
Accepted
time: 11ms
memory: 5644kb

input:

ACRQARMBBQMC

output:

Bob

result:

ok single line: 'Bob'

Test #31:

score: 0
Accepted
time: 2ms
memory: 4028kb

input:

MRCQBCBQRMAA

output:

Alice

result:

ok single line: 'Alice'

Test #32:

score: 0
Accepted
time: 10ms
memory: 5960kb

input:

ACRQQCMMBBAR

output:

Bob

result:

ok single line: 'Bob'

Test #33:

score: 0
Accepted
time: 5ms
memory: 5080kb

input:

MMACQBRQABRC

output:

Bob

result:

ok single line: 'Bob'

Test #34:

score: 0
Accepted
time: 3ms
memory: 4100kb

input:

QACMQABRMCBR

output:

Alice

result:

ok single line: 'Alice'

Test #35:

score: 0
Accepted
time: 7ms
memory: 5740kb

input:

ACAQRCMRMBQB

output:

Alice

result:

ok single line: 'Alice'

Test #36:

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

input:

RABQCQMCABMR

output:

Bob

result:

ok single line: 'Bob'

Test #37:

score: 0
Accepted
time: 9ms
memory: 5260kb

input:

QQBARCRBMMAC

output:

Alice

result:

ok single line: 'Alice'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

RQMRQABCABCM

output:

Alice

result:

ok single line: 'Alice'

Test #39:

score: 0
Accepted
time: 0ms
memory: 4404kb

input:

RQAMBRQCCBMA

output:

Alice

result:

ok single line: 'Alice'

Test #40:

score: 0
Accepted
time: 2ms
memory: 4016kb

input:

QQBACMARMRBC

output:

Alice

result:

ok single line: 'Alice'

Test #41:

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

input:

QAQCRRAMMCBB

output:

Alice

result:

ok single line: 'Alice'

Test #42:

score: 0
Accepted
time: 10ms
memory: 5388kb

input:

QQBMCBRARMAC

output:

Bob

result:

ok single line: 'Bob'

Test #43:

score: 0
Accepted
time: 80ms
memory: 14884kb

input:

BABARRCCQQMM

output:

Bob

result:

ok single line: 'Bob'

Test #44:

score: 0
Accepted
time: 458ms
memory: 51652kb

input:

BBARARCCQQMM

output:

Alice

result:

ok single line: 'Alice'

Test #45:

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

input:

BBAARCRCQQMM

output:

Alice

result:

ok single line: 'Alice'

Test #46:

score: 0
Accepted
time: 139ms
memory: 21748kb

input:

BBAARRCQCQMM

output:

Bob

result:

ok single line: 'Bob'

Test #47:

score: 0
Accepted
time: 105ms
memory: 17852kb

input:

BBAARRCCQMQM

output:

Bob

result:

ok single line: 'Bob'

Test #48:

score: 0
Accepted
time: 319ms
memory: 42040kb

input:

BBAACCRQMQRM

output:

Bob

result:

ok single line: 'Bob'

Test #49:

score: 0
Accepted
time: 438ms
memory: 54652kb

input:

BACBACQRRQMM

output:

Bob

result:

ok single line: 'Bob'

Test #50:

score: 0
Accepted
time: 1106ms
memory: 112572kb

input:

RAABBRCCQQMM

output:

Bob

result:

ok single line: 'Bob'

Test #51:

score: 0
Accepted
time: 59ms
memory: 12772kb

input:

RABRBQMCACQM

output:

Bob

result:

ok single line: 'Bob'

Test #52:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

CMMQQABCRABR

output:

Alice

result:

ok single line: 'Alice'

Test #53:

score: 0
Accepted
time: 184ms
memory: 27364kb

input:

RBAABRCCQQMM

output:

Alice

result:

ok single line: 'Alice'

Extra Test:

score: 0
Extra Test Passed