QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396727#5535. Popealasichengzhou#17 182ms10044kbC++141.1kb2024-04-23 08:34:152024-07-04 03:36:46

Judging History

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

  • [2024-07-04 03:36:46]
  • 评测
  • 测评结果:17
  • 用时:182ms
  • 内存:10044kb
  • [2024-04-23 08:34:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e4+4,M=52;
int n,m,S,a[M][N],f[M][N],s[N],c[M];
char ch[M][N];
int main()
{
    scanf("%d%d%d",&n,&m,&S);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&s[i]);
        s[i]+=s[i-1];
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%s",ch[i]+1);
    }
    f[0][0]=0;
    for(int i=1;i<=S;i++)
    {
        for(int j=1;j<=m;j++)
        {
            f[i][j]=2e9+1;
            for(int t=1;t<=n;t++)
            {
                c[t]=1;
            }
            for(int k=j-1;k>=i-1;k--)
            {
                int cnt=0;
                for(int t=1;t<=n;t++)
                {
                    if(ch[t][k+1]=='0')
                    {
                        c[t]=0;
                    }
                    cnt+=c[t];
                }
                if(i==1&&k>0)
                {
                    continue;
                }
                f[i][j]=min(f[i][j],f[i-1][k]+(s[j]-s[k])*cnt);
            }
        }
        printf("%d\n",f[i][m]);
    }
    return 0;
}

详细

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 1ms
memory: 3920kb

input:

2 3 3
4 3 5
101
110

output:

0
8
16

result:

ok 3 lines

Test #2:

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

input:

35 40 15
3657 2870 9633 4742 6403 1197 1327 9983 5095 1033 2356 2681 9948 6851 6494 1965 6698 5860 8718 3453 9739 5794 7452 9556 5798 5141 4009 1869 2474 6480 8270 6280 4446 8052 2155 3226 1667 843 2851 6305
1001111110101111111111111110111111111111
1111111111111111111111111111111111111111
1111111111...

output:

2237081
2324849
2390859
2474206
2512547
2586745
2634155
2721923
2787933
2965077
3067335
3199190
3273388
3320798
3497942

result:

ok 15 lines

Subtask #2:

score: 9
Accepted

Test #3:

score: 9
Accepted
time: 174ms
memory: 10044kb

input:

50 500 50
2038 388 7128 2805 5579 3731 7082 6271 5626 5928 8728 304 2767 8798 8311 8389 7924 1727 8612 7438 6588 7056 4588 3823 4615 4201 6337 370 1178 2694 7211 5841 6159 5419 7907 7080 1436 1867 4643 7361 1743 3185 9089 2317 593 9466 8700 9757 8776 8077 1274 1951 4362 1077 3344 2876 4067 1267 8350...

output:

0
95786
114798
244998
580014
717459
985251
1168070
1515088
1816096
2029416
2220312
2309682
2390264
2424480
2759496
2896941
3164733
3347552
3694570
3964964
4276878
4561422
4894290
5003990
5139573
5527629
5756985
5971037
6262492
6443498
6612787
6894109
7085248
7273926
7535859
7746387
8014179
8196998
8...

result:

ok 50 lines

Test #4:

score: 0
Accepted
time: 169ms
memory: 8236kb

input:

48 500 50
446 3830 1528 4330 8911 4558 846 2868 9188 1998 3322 1814 2987 5215 7205 9816 5235 4701 4702 6676 2319 1784 5640 9926 8364 4807 4576 1935 9599 4040 2345 1633 4142 6357 9262 9937 4120 3173 7766 9601 8936 3122 4307 4714 6174 6772 9560 3922 8704 5953 5511 2445 7737 4847 3210 886 6021 9644 803...

output:

0
21408
78954
207754
262858
446698
518514
726354
1052758
1260598
1379440
1514236
1803401
1987241
2059057
2266897
2437072
2676962
2919983
3054779
3409065
3587711
3747167
3834239
3977615
4217505
4548935
4878013
5209443
5467997
5688991
5975512
6111756
6195604
6455044
6809330
7115552
7538608
7744528
783...

result:

ok 50 lines

Test #5:

score: 0
Accepted
time: 182ms
memory: 8188kb

input:

50 500 50
6699 143 4520 2827 506 5190 6117 6490 2219 1723 8693 6430 268 7651 2239 5694 9812 7679 7286 919 6700 9632 2940 3900 9214 7738 3303 1608 8103 406 8651 1959 3280 9029 9278 8175 7398 1742 2818 5354 6941 7740 5687 2549 5345 2267 516 1112 3027 1353 238 8848 8516 1674 4127 8982 4214 1833 2398 94...

output:

0
75650
328273
403923
602803
686125
761775
1016085
1263535
1517845
1718599
1829161
2142083
2330921
2591745
2785985
3027953
3209469
3407613
3617926
3687751
3942061
4152895
4239093
4493403
4755137
4967314
5030524
5284834
5590684
5743514
5867414
6091442
6345752
6651602
6810900
6934800
7158828
7573484
7...

result:

ok 50 lines

Subtask #3:

score: 0
Time Limit Exceeded

Test #6:

score: 0
Time Limit Exceeded

input:

48 2200 50
337 3453 6137 1365 4085 2098 573 5755 4273 791 629 3815 1240 5977 8595 9987 9020 5999 9071 655 8343 4000 5410 3356 4673 7505 8440 259 5473 9902 7131 1896 8264 816 2911 1052 8757 5517 4111 9878 7684 3757 5880 6524 6338 7356 1354 3100 9447 8440 8994 4598 1942 7759 3915 3175 980 5528 3090 77...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%