QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217239#5535. PopealaCamillus#26 1945ms4880kbC++201.4kb2023-10-16 17:33:012024-07-04 02:20:27

Judging History

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

  • [2024-07-04 02:20:27]
  • 评测
  • 测评结果:26
  • 用时:1945ms
  • 内存:4880kb
  • [2023-10-16 17:33:01]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#else
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, t, s;
    cin >> n >> t >> s;
    vector<int> p(t);
    for (int i = 0; i < t; i++) {
        cin >> p[i];
    }
    vector<vector<bool>> r(n, vector<bool>(t));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < t; j++) {
            char x;
            cin >> x;

            r[i][j] = (x == '1');
        }
    }

    vector<vector<int>> dp(s + 1, vector<int>(t + 1, INT32_MAX));
    dp[0][0] = 0;
    for (int j = 1; j <= s; j++) {
        for (int i = 1; i <= t; i++) {
            vector<int> g(n);
            iota(g.begin(), g.end(), 0); 
            int sum = 0;     
            for (int l = 1; l <= i; l++) {
                sum += p[i - l];
                for (size_t p = 0; p < g.size();) {
                    if (!r[g[p]][i - l]) {
                        swap(g.back(), g[p]);
                        g.pop_back();
                    } else {
                        p++;
                    }
                }
                dp[j][i] = min(dp[j][i], dp[j - 1][i - l] + (int)g.size() * sum);
            }
        }
        cout << dp[j][t] << '\n';
    }
    return 0;
}

詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 0ms
memory: 3544kb

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: 3624kb

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: 58ms
memory: 3788kb

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: 65ms
memory: 3912kb

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: 68ms
memory: 3688kb

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: 9
Accepted

Test #6:

score: 9
Accepted
time: 440ms
memory: 4304kb

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:

0
0
0
0
0
0
660
1718
3383
7088
12274
27776
53830
98036
155047
181101
309819
445072
559490
686254
836830
992254
1134321
1269574
1383992
1510756
1661332
1775704
1904422
2038217
2154093
2280857
2431433
2586857
2729260
2884684
3039287
3166051
3321475
3488325
3640414
3790990
3917932
4068508
4209483
43362...

result:

ok 50 lines

Test #7:

score: 0
Accepted
time: 772ms
memory: 4376kb

input:

50 3000 50
5950 9687 1494 6034 4761 8813 28 5374 6549 5784 7122 6628 7625 1592 8053 6314 9372 6900 648 6460 9268 1116 8934 4230 1174 7325 9231 2614 772 4884 4623 9657 1066 3497 7229 1688 8252 2304 5745 1326 9955 3210 8024 6132 3843 5064 2006 6419 71 2345 198 8006 1436 7082 1269 7055 9759 5497 6895 1...

output:

0
0
0
245
1568
12203
29667
79846
154150
252262
360356
458468
602146
700258
855538
993529
1104983
1252566
1350678
1505958
1643949
1764141
1943732
2063924
2253778
2462901
2583093
2772947
2989382
3146278
3362713
3520158
3736593
4006843
4193364
4383218
4628512
4756549
5002392
5130429
5400679
5674379
588...

result:

ok 50 lines

Test #8:

score: 0
Accepted
time: 1945ms
memory: 4880kb

input:

50 4000 50
4834 5642 7536 3065 7147 350 2008 8039 3592 4684 3322 807 7023 2937 6910 1227 2027 164 2114 9086 8542 3383 552 4788 35 1988 3351 3344 1515 47 1778 5064 6486 3858 6470 8794 796 4418 93 8192 6908 6828 5856 8724 4727 5801 9128 149 9060 442 7609 4429 555 476 6766 8033 9525 7092 1087 9092 2261...

output:

0
0
960
3400
93350
160662
329266
374002
610868
736276
973142
1103078
1339944
1616402
1841701
1994630
2231496
2318246
2480630
2648601
2682901
2919767
3196225
3461989
3715674
3876356
3982056
4181769
4344330
4605432
4711132
5059032
5184080
5347130
5468027
5539945
5625289
5753285
5838629
6086765
6200903...

result:

ok 50 lines

Subtask #4:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #9:

score: 0
Time Limit Exceeded

input:

48 20000 50
1549 695 1682 1506 1690 1775 1618 1612 1266 143 616 1765 8 478 1380 917 565 377 1666 483 25 1352 1436 47 865 885 1243 1364 13 880 722 1434 1839 707 1504 1694 285 1764 147 53 1261 854 130 1779 1770 245 1328 717 865 1423 1256 1697 1335 1435 342 1119 797 1005 1042 249 1406 781 1593 1326 770...

output:


result: