UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#190199#3312. 圆heyuzhen100615ms15768kbC++11487b2023-10-05 11:34:582023-10-05 12:51:01

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,ans,a[1000005],d[1000005],now,p;string s,x;bool ok = 1;
int main(){
	cin >> n >> s;
	for(ll i=0;i<n;i++)if(s[i]=='1')ok = 0,p=i;
	if(ok){for(ll i=1;i<=n;i++)cout<<n*(n-i+1)<<"\n";return 0;}
	x=s+s;for(ll i=0;i<n;i++)s[i]=x[p+i+1];
	for(ll i=0;i<n;i++){if(s[i]=='1')now=0;else d[1]++,d[(++now+1)/2+1]--;}
	for(ll i=1;i<=n;i++)a[i]=a[i-1]+d[i];
	for(ll i=1;i<=n;i++)cout<<a[i]*(n-i+1)<<"\n";
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

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

input:

100
000000000000000000000000001000000000000000010000110000000000000000000000000000000000000000000000...

output:

9600
8910
8232
7760
7296
6840
6392
5952
5520
5278
5040
4806
4576
4350
4128
3910
3696
3486
3280
3078
...

result:

ok 100 lines

Test #2:

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

input:

100
111000000000000000001100000000000001111100000000000100000000000000000000000010000000000000000000...

output:

8800
7722
6664
5626
4608
3610
2726
2046
1472
1001
630
267
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100 lines

Test #3:

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

input:

1000
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

966000
930069
897202
865396
839628
814905
790230
765603
741024
716493
693000
672520
654056
635628
61...

result:

ok 1000 lines

Test #4:

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

input:

1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

968000
939060
914168
889324
864528
841770
819056
796386
773760
751178
730620
710102
689624
669186
64...

result:

ok 1000 lines

Test #5:

score: 10
Accepted
time: 109ms
memory: 14656kb

input:

1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

999941000000
999877000122
999818000360
999763000702
999708001152
999653001710
999598002376
999543003...

result:

ok 1000000 lines

Test #6:

score: 10
Accepted
time: 102ms
memory: 14036kb

input:

1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

999945000000
999888000111
999833000330
999778000657
999723001092
999668001635
999613002286
999558003...

result:

ok 1000000 lines

Test #7:

score: 10
Accepted
time: 96ms
memory: 15768kb

input:

1000000
11110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

999996000000
999993000006
999990000016
999987000030
999984000048
999981000070
999978000096
999975000...

result:

ok 1000000 lines

Test #8:

score: 10
Accepted
time: 96ms
memory: 14472kb

input:

1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

999935000000
999876000123
999817000362
999760000711
999703001172
999646001745
999589002430
999534003...

result:

ok 1000000 lines

Test #9:

score: 10
Accepted
time: 98ms
memory: 14116kb

input:

1000000
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

999968000000
999945000054
999922000152
999899000294
999876000480
999853000710
999830000984
999807001...

result:

ok 1000000 lines

Test #10:

score: 10
Accepted
time: 114ms
memory: 2100kb

input:

1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

1000000000000
999999000000
999998000000
999997000000
999996000000
999995000000
999994000000
99999300...

result:

ok 1000000 lines

Extra Test:

score: 0
Extra Test Passed