QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#120646#4327. Šeširizhouhuanyi#21 175ms4004kbC++111016b2023-07-07 08:47:082024-05-26 02:57:40

Judging History

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

  • [2024-05-26 02:57:40]
  • 评测
  • 测评结果:21
  • 用时:175ms
  • 内存:4004kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 08:47:08]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
#define N 18
#define eps 1e-7
using namespace std;
int read()
{
    char c=0;
    int sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
int n,delta[N+1];
double X[N+1],Y[N+1];
const double Pi=asin(1)*2;
int main()
{
    int cnt,rst,d;
    double sx,sy;
    n=read();
    for (int i=1;i<=n;++i) X[i]=cos(2*i*Pi/n),Y[i]=sin(2*i*Pi/n);
    for (int i=1;i<=n;++i)
    {
	for (int j=0;j<(1<<(n-1));++j)
	{
	    sx=sy=rst=d=0,cnt=n-2;
	    for (int k=1;k<=n;++k)
		if (i!=k)
		    delta[k]=(j>>cnt)&1,cnt--;
	    cnt=1;
	    for (int k=i+1;k<=n;++k)
	    {
		if (delta[k]) rst++,sx+=X[cnt],sy+=Y[cnt];
		cnt++;
	    }
	    for (int k=1;k<=i-1;++k)
	    {
		if (delta[k]) rst++,sx+=X[cnt],sy+=Y[cnt];
		cnt++;
	    }
	    if (abs(sy)<eps) d=abs(sx)>=eps;
	    else d=(sy<0)^(rst&1);
	    printf("%c",(!d)?'B':'C');
	}
	puts("");
    }
    return 0;
}

詳細信息

Subtask #1:

score: 7
Accepted

Test #1:

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

input:

4

output:

BBCCCBBC
BCCBBCBC
BCBBCBCC
BBCCCBBC

result:

ok good plan!

Subtask #2:

score: 7
Accepted

Test #2:

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

input:

5

output:

BBBCCCCBCCBBBCCC
BBCCCBBCBCCBCBCC
BCCBBCCCBCBCCBBC
BCBCBBCBCBCCCCBC
BBBCCCCBCCBBBCCC

result:

ok good plan!

Subtask #3:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 3948kb

input:

6

output:

BBBCCCCBCBCBBCCCCCBBBBCCBCCBCBBC
BBCCCCBCCBBCBCCBBCCBBBCCCBBCCBBC
BCCBCBBCBCBCCBCBBCCCBCCBCBBCBCBC
BCCBBBCCBCBCCBBBCBBCCCBBCCCBBCCC
BCBCBBCBCBCBCCBCCBBCCCBBBCCBCBCC
BBBCCCCBCBCBBCCCCCBBBBCCBCCBCBBC

result:

wrong answer your plan fails on CCCBBB

Subtask #4:

score: 7
Accepted

Test #4:

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

input:

7

output:

BBBCBCCBCCCBCBBCCBCBBBBCBCCCCBCBCCCBBBBCBCCCCCCBBCCCCBBBCBBCBCCC
BBBCCCCBCCBBBCCCCCBBBCCCBCCBCBBCBCCBCBBCBBBCCCBBCBBCCCCBCCBBBCCC
BBCCCBBCCBBCBCCBBCCBBBCBCBCCCBBCBCCBCBCCCBCCCBBCCBBCBCCBBCCBCBCC
BCCBCBBCBCBCCCCBBCCCCCCBCBBCBCCCBCBCBCCBCBBBBCBCCBBCBCBCBCCBCBBC
BCCBBBCCBCCCCBBCBBBCCBBBCBBBBCCBCBBCCCCB...

result:

ok good plan!

Subtask #5:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3844kb

input:

8

output:

BBBCBCCBCCCBCBBCCBCBCBBCBCBCCCCBCBBBBBBCBCCCCCCBBCCBCBCBCBBCBCCCCCCBBBBCBCBCCCCBBCCCCBCBCBBBBCBCBCCCCBBBCBBCBCCCCBBCBCCBBCCBCBBC
BBBCCCCBCCCBBBCCCBBBBCCCBCCCCBBCCCBBBBCCBCCCCBBBBCCBCBBCCBBCBCCBBCCBCBBCBBBCCCCBBBBCCCCBCBBBBCCCCBBCCCCBCCBBBBCCCCBBBCCCBCCBCBBC
BBCCCCBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBBBCCBB...

result:

wrong answer your plan fails on CCCBBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 3956kb

input:

9

output:

BBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBCBCBBCBBBCBCCBBCCCCCCBCBCBCBBCCBCBBBBCBBBCBCCBBCCCCCCBCBCBBBBCBCCBCBCBCBBBBCBCCBBCBCCCBCCBCBCBCCCBCBBCBBBCBCCBBCBCCCCBCCCBCBBCBCCCCCCBCBBBBBBCCBBCBCCCBCCCCCCBBCCCCBCBCBBBBBBCCBBCBCCCBCCBCBCBCBBCBCCCBCCBCBBBBCCBCBBCCBBCBCCC
BBBCBCCBCCCBCBBCCCCBBBBCBCCCCCCBCCBBBBBCBCC...

result:

wrong answer your plan fails on CCCCCCCBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 1ms
memory: 3816kb

input:

10

output:

BBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBCBCBBCCBBCBCCBBCBCBCCBCCCBCBBCCBBBCBBCBBBCBCCBBCCCCCCBCCCBCBBCBCCBCCCBCBCBCBBCCBBCBCBCBCCCCCCBCBCBBBBCBBBCBCCBBCCCCCCBCCCBCBBCBCCCCBCBCBCBCBBCCBBCBCBCBCCCCCCBBCCBCBBBCBBBBBBCCBBCBCCCBCCCCCCBCBBCBCCBBCCBCBCBBCCBCBBCCBBCBCCCCCCBCBBCBBBCBCCBBCBCBCCBCCCBCBBCBCCCCCCBCBCB...

result:

wrong answer your plan fails on CCCBBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 3852kb

input:

11

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBCBCBBCCBBCBCCBBBBCBCCBBCCBCBBCBCCCCCCBCCCBCBBCCBCBCBBCCBBCBCCBCBBBCBBCBBBCBCCBBCBCBCCBBCCBCBBCBCCCCCCBCCCBCBBCCBBBCBBCBBBCBCCBBCCBCBCBCBBBCBBCCBBCBBBCBCBCBCCBCBBCBCCCBCCCCCCBBCCBCBCBCBBBCBBCCBCBCBBCBBBCBCCBBCBCBCCBBCCBCBBCBCCCCCCBCCCB...

result:

wrong answer your plan fails on CCCCCCCCBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 2ms
memory: 3916kb

input:

12

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBBBCBBCCBBCBCCBBBBCBCCBBCCBCBBCBCCCBCCBCCCBCBBCCCCBCBBCCBBCBCCBBCCBCCCBCCCBCBBCCBCBCBBCCBBCBCCBCBBCBBBCBCBCBCCBBCCCBCCBCCCBCBBCCBBBBBBCBBBCBCCBBBBCBCCBBCCBCBBCBCCCCCCBCCCB...

result:

wrong answer your plan fails on CCCBBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 4ms
memory: 4004kb

input:

13

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBBCBBCCBBCBCCBBBBCBCCBBCCBCBBCBCBCBCCBBCCB...

result:

wrong answer your plan fails on CCCCCBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 9ms
memory: 3956kb

input:

14

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBBBCBCCBBCCB...

result:

wrong answer your plan fails on CCCBBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 18ms
memory: 3848kb

input:

15

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCB...

result:

wrong answer your plan fails on CCCCCBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 39ms
memory: 3868kb

input:

16

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCB...

result:

wrong answer your plan fails on CCCBBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 78ms
memory: 3876kb

input:

17

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCB...

result:

wrong answer your plan fails on CCCCCBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 175ms
memory: 3860kb

input:

18

output:

BBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCCCBCBBCCBBCBCCBCBBCBCCBBCCBCBBCCBBCBCCBBCCB...

result:

wrong answer your plan fails on CCCBBBBBBBBBBBBBBB