QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#231865 | #5434. Binary Substrings | inverno | WA | 0ms | 3744kb | C++14 | 362b | 2023-10-29 17:22:59 | 2023-10-29 17:23:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n ;cin >> n;
int w = log2(n);
if (!w) w = 1;
bool ch = 1;
for (int i = 1;i <= n;i += w){
for (int j = 1;j <= min(n-i+1,w);++ j) {
if (ch) putchar('0');
else putchar('1');
}
ch^=1;
}
putchar('\n');
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
2
output:
01
result:
ok meet maximum 3
Test #2:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
5
output:
00110
result:
ok meet maximum 12
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1
output:
0
result:
ok meet maximum 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
3
output:
010
result:
ok meet maximum 5
Test #5:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
4
output:
0011
result:
ok meet maximum 8
Test #6:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
6
output:
001100
result:
ok meet maximum 16
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
7
output:
0011001
result:
wrong answer not meet maximum 20 < 21