QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123368#5434. Binary Substringssuyue#WA 0ms1860kbC++14573b2023-07-12 13:55:432023-07-12 13:55:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-12 13:55:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1860kb
  • [2023-07-12 13:55:43]
  • 提交

answer

#include<stdio.h>
#define ll long long
int n;
ll cal(int a,int b,int c){
    return 1ll*a*b+1ll*b*c+1ll*a*c;
}
int main(){
    scanf("%d",&n);
    int a,b,c;
    ll maxs=0,maxc=0;
    for(int i=1;i<=n;i++){
        c=i;
        a=(n-c)/2;
        b=n-a-c;
        ll p=cal(a,b,c);
        if(p>maxs){
            maxs=p;
            maxc=i;
        }
    }
    c=maxc;
    a=(n-c)/2;
    b=n-a-c;
    for(int i=1;i<=a;i++)putchar('0');
    for(int i=1;i<=b;i++)putchar('1');
    for(int i=1;i<=c;i++)putchar('0');
    puts("");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

10

result:

ok meet maximum 3

Test #2:

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

input:

5

output:

00110

result:

ok meet maximum 12

Test #3:

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

input:

1

output:

1

result:

ok meet maximum 1

Test #4:

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

input:

3

output:

010

result:

ok meet maximum 5

Test #5:

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

input:

4

output:

0110

result:

ok meet maximum 8

Test #6:

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

input:

6

output:

001100

result:

ok meet maximum 16

Test #7:

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

input:

7

output:

0011100

result:

ok meet maximum 21

Test #8:

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

input:

8

output:

00011100

result:

ok meet maximum 27

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 1556kb

input:

9

output:

000111000

result:

wrong answer not meet maximum 33 < 34