QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#888235#795. Cloud ComputingI_love_Riley_Andersen#18 206ms5120kbC++172.6kb2025-02-08 01:28:512025-02-08 01:29:02

Judging History

This is the latest submission verdict.

  • [2025-02-08 01:29:02]
  • Judged
  • Verdict: 18
  • Time: 206ms
  • Memory: 5120kb
  • [2025-02-08 01:28:51]
  • Submitted

answer

#include"bits/stdc++.h"
#include"ext/pb_ds/tree_policy.hpp"
#include"ext/pb_ds/assoc_container.hpp"
using namespace std;
using namespace __gnu_pbds;
#define FOR(i,a,b)for(int i=a;i<b;i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=b-1;a<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)*max_element(all(a))
#define MAXX(a,b)*max_element(a,a+b)
#define MIN(a)*min_element(all(a))
#define MINN(a,b)*min_element(a,a+b)
#define con const int
#define lwb lower_bound
#define upb upper_bound
#define bry binary_search
#ifdef LOCAL
#define print(x)cout<<x;
#else
#define print(...)
#endif
#define debug(x)print(#x<<" = "<<x<<endl)
using ld=long double;
using ll=long long;
using str=string;
template<class T>using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>using omset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>T minn(T a){return a;}
template<class T,class...Args>T minn(T a,Args... args){return min(a,minn(args...));}
template<class T>T maxx(T a){return a;}
template<class T,class...Args>T maxx(T a,Args... args){return max(a,maxx(args...));}
#define SMIN(a,b...)a=min(a,minn(b))
#define SMAX(a,b...)a=max(a,maxx(b))
void fileset(str a){assert(nullptr!=freopen((a+".in").c_str(),"r",stdin)&&nullptr!=freopen((a+".out").c_str(),"w",stdout));}
vector<tuple<int,int,int>> comps;
vector<tuple<int,int,int>> ordrs;

con mxSm = 1e5 + 5;

ll mx[mxSm];
ll mn[mxSm];

int main(){
    int N;
    cin >> N;

    int smN = 0;

    F0R (i, N){
        int c, f, v;
        cin >> c >> f >> v;

        comps.emplace_back(c, f, v);
        smN += c;
    }

    int M;
    cin >> M;

    int smM = 0;

    F0R (i, M){
        int C, F, V;
        cin >> C >> F >> V;

        ordrs.emplace_back(C, F, V);
        smM += C;
    }

    memset(mn, 0x3f, sizeof(mn));
    mn[0] = 0;

    F0R (i, N){
        auto& [c, f, v] = comps[i];

        ROF (j, c, smN + 1){
            SMIN(mn[j], mn[j - c] + v);
        }
    }

    F0R (i, M){
        auto& [C, F, V] = ordrs[i];

        ROF (j, C, smM + 1){
            SMAX(mx[j], mx[j - C] + V);
        }
    }

    ll bst = 0;
    ll ans = 0;

    F0R (i, smN + 1){
        SMAX(bst, mx[i]);
        SMAX(ans, bst - mn[i]);
    }

    cout << ans << endl;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 18
Accepted
time: 1ms
memory: 4224kb

input:

1
3 3253 744
1
1 2012 798

output:

54

result:

ok single line: '54'

Test #2:

score: 18
Accepted
time: 0ms
memory: 4352kb

input:

1
1 2291 728
1
3 3024 858

output:

0

result:

ok single line: '0'

Test #3:

score: 18
Accepted
time: 0ms
memory: 4352kb

input:

8
18 5754 6872
11 5543 1464
6 6940 9405
10 5152 4196
13 5784 7499
18 6787 260
14 5922 218
17 5037 7983
100
3 5482 4812
1 3922 7167
3 3566 8041
2 3532 3839
3 3948 4490
2 5301 6616
3 4216 796
2 4583 5021
1 3311 3984
3 3044 2702
2 4529 288
2 3352 6474
2 3102 4548
3 3784 2968
2 5054 2143
2 5385 1542
3 3...

output:

368159

result:

ok single line: '368159'

Test #4:

score: 18
Accepted
time: 1ms
memory: 4352kb

input:

7
11 6380 2002853
5 6813 1069986
13 5521 2570534
12 5793 1980585
9 6767 423810
19 5421 2358687
3 6223 527470
200
2 5408 222070
2 5072 205933
1 5263 95185
2 4419 43779
2 4337 128477
1 4234 73697
2 3655 35020
1 3599 60877
1 3391 14190
1 4499 59363
3 5218 428777
1 3617 15308
1 3932 67554
1 3847 16460
2...

output:

909469

result:

ok single line: '909469'

Test #5:

score: 0
Wrong Answer
time: 53ms
memory: 4736kb

input:

15
38 253050473 94982
19 873235634 3331
34 96232154 99722
18 361560017 18236
1 43839514 70819
30 211957237 36759
21 276441039 97496
10 677009897 39625
43 899961447 35095
15 278681496 20167
16 777735821 93692
39 295651318 33500
40 814700985 79446
14 174272701 32273
33 149679268 37695
1900
23 83103560...

output:

8444340

result:

wrong answer 1st lines differ - expected: '7591941', found: '8444340'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 4352kb

input:

12
1 3728 3883
1 2483 1377
1 2421 2213
1 4866 648
1 2292 1737
1 4027 657
1 2119 2801
1 2559 859
1 3859 3261
1 2908 3110
1 2917 2467
1 2011 3406
18
1 2558 4956
1 3468 2947
1 4577 4082
1 2886 2222
1 2979 3572
1 2266 4860
1 2868 3183
1 3665 4259
1 2607 4802
1 2811 3874
1 2314 4212
1 2638 3152
1 2944 44...

output:

25484

result:

wrong answer 1st lines differ - expected: '23934', found: '25484'

Subtask #4:

score: 18
Accepted

Test #26:

score: 18
Accepted
time: 0ms
memory: 4352kb

input:

10
2 1 2274
2 1 2524
1 1 2699
5 1 2930
4 1 1802
2 1 2734
4 1 1036
3 1 2741
5 1 1138
1 1 2132
6
5 1 3573
1 1 4847
2 1 3885
1 1 2183
2 1 2534
1 1 4659

output:

17705

result:

ok single line: '17705'

Test #27:

score: 18
Accepted
time: 0ms
memory: 4352kb

input:

10
5 1 19
3 1 14
4 1 10
3 1 10
4 1 20
2 1 9
1 1 4
4 1 10
1 1 2
3 1 10
6
5 1 13
5 1 13
3 1 10
1 1 3
5 1 13
5 1 13

output:

4

result:

ok single line: '4'

Test #28:

score: 18
Accepted
time: 3ms
memory: 4352kb

input:

1500
5 1 766
1 1 925
5 1 545
5 1 916
1 1 747
3 1 981
2 1 794
1 1 853
4 1 745
2 1 539
4 1 611
3 1 730
2 1 995
4 1 663
1 1 667
4 1 615
3 1 813
3 1 750
2 1 917
3 1 568
1 1 602
1 1 792
1 1 774
5 1 860
5 1 834
1 1 946
2 1 567
3 1 770
3 1 750
5 1 752
4 1 718
3 1 987
2 1 977
4 1 838
2 1 642
4 1 558
4 1 878...

output:

0

result:

ok single line: '0'

Test #29:

score: 18
Accepted
time: 10ms
memory: 4352kb

input:

13
20 1 9848
33 1 11113
33 1 11397
43 1 5486
19 1 10018
37 1 8534
43 1 7616
43 1 5394
13 1 11453
44 1 11120
29 1 11057
46 1 9023
20 1 11984
1805
9 1 845
4 1 355
6 1 818
7 1 307
9 1 354
9 1 593
10 1 650
3 1 962
5 1 273
8 1 873
1 1 420
7 1 948
4 1 668
1 1 708
6 1 616
7 1 594
9 1 201
7 1 768
3 1 802
7 ...

output:

102484

result:

ok single line: '102484'

Test #30:

score: 18
Accepted
time: 104ms
memory: 4736kb

input:

1992
11 1 199631204
46 1 880088920
46 1 60421978
41 1 374317414
26 1 752692847
46 1 745140558
12 1 64000008
5 1 454886525
13 1 69573629
15 1 522471571
38 1 611340638
20 1 11136794
14 1 757697844
29 1 474321924
42 1 911180569
9 1 569689273
14 1 321726981
14 1 236570294
36 1 312654389
23 1 35766191
27...

output:

575524668672

result:

ok single line: '575524668672'

Test #31:

score: 18
Accepted
time: 206ms
memory: 4864kb

input:

2000
43 1 160482641
50 1 128216371
43 1 795777040
48 1 639914818
44 1 341588814
50 1 694546956
47 1 111220218
44 1 529410604
49 1 33620380
47 1 488422815
48 1 689416355
44 1 128908044
43 1 804535816
43 1 778001742
46 1 332918417
42 1 757120862
40 1 835341946
48 1 69935722
40 1 702766873
46 1 9924335...

output:

0

result:

ok single line: '0'

Test #32:

score: 18
Accepted
time: 206ms
memory: 5120kb

input:

2000
46 1 16
46 1 12
41 1 6
43 1 13
43 1 16
47 1 16
43 1 2
40 1 14
50 1 14
42 1 12
50 1 3
45 1 1
41 1 3
48 1 6
46 1 18
47 1 17
48 1 18
41 1 6
44 1 13
43 1 2
46 1 9
45 1 14
45 1 14
47 1 2
41 1 3
45 1 8
42 1 13
48 1 13
42 1 3
40 1 18
48 1 19
48 1 11
47 1 9
41 1 16
49 1 8
45 1 8
48 1 1
47 1 13
50 1 6
4...

output:

1000605883784

result:

ok single line: '1000605883784'

Test #33:

score: 18
Accepted
time: 196ms
memory: 5120kb

input:

1937
48 1 10
44 1 17
45 1 15
40 1 3
47 1 13
45 1 3
41 1 13
50 1 8
45 1 18
50 1 4
49 1 5
48 1 9
50 1 19
46 1 14
48 1 2
45 1 5
42 1 2
50 1 17
42 1 4
50 1 20
47 1 5
40 1 19
44 1 16
44 1 9
40 1 7
45 1 2
47 1 5
50 1 13
47 1 19
43 1 11
45 1 4
46 1 9
46 1 7
49 1 12
45 1 1
42 1 13
46 1 7
46 1 1
49 1 3
49 1 ...

output:

976944450013

result:

ok single line: '976944450013'

Subtask #5:

score: 0
Wrong Answer

Test #34:

score: 18
Accepted
time: 0ms
memory: 4224kb

input:

4
43 2536 1
48 2001 1
49 3407 1
48 3778 1
2
42 3314 1
43 3073 1

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Wrong Answer
time: 0ms
memory: 4480kb

input:

57
47 1212 1
42 1104 1
48 1247 1
44 1420 1
41 1428 1
46 1364 1
47 1245 1
40 1199 1
48 1027 1
49 1113 1
50 1439 1
45 1208 1
41 1231 1
41 1131 1
48 1080 1
43 1218 1
45 1145 1
44 1071 1
43 1393 1
47 1314 1
45 1306 1
47 1439 1
42 1124 1
49 1383 1
47 1175 1
45 1099 1
46 1378 1
45 1285 1
46 1323 1
41 1234...

output:

5

result:

wrong answer 1st lines differ - expected: '0', found: '5'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%