QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#888229 | #795. Cloud Computing | I_love_Riley_Andersen# | 18 | 2ms | 9856kb | C++17 | 2.9kb | 2025-02-08 00:53:28 | 2025-02-08 00:53:29 |
Judging History
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));}
con mxN = 2e3 + 3;
vector<tuple<int,int,int>> comps;
vector<tuple<int,int,int>> ordrs;
int vis[mxN][mxN];
ll dp[mxN][mxN];
int N, M;
ll go(int i, int j){
if (i == N || j == M) {
return 0;
}
if (!vis[i][j]){
vis[i][j] = 1;
auto& [c, f, v] = comps[i];
auto& [C, F, V] = ordrs[j];
if (f >= F){
SMAX(dp[i][j], go(i + 1, j + 1) + V - v);
}
SMAX(dp[i][j], go(i + 1, j));
SMAX(dp[i][j], go(i, j + 1));
}
return dp[i][j];
}
int main(){
cin >> N;
F0R (i, N){
int c, f, v;
cin >> c >> f >> v;
comps.emplace_back(c, f, v);
}
cin >> M;
F0R (i, M){
int C, F, V;
cin >> C >> F >> V;
ordrs.emplace_back(C, F, V);
}
sort(all(comps),[](auto& i, auto& j){
auto& [ci, fi, vi] = i;
auto& [cj, fj, vj] = j;
if (fi ^ fj){
return fi < fj;
} else {
return vi < vj;
}
});
sort(all(ordrs),[](auto& i, auto& j){
auto& [ci, fi, vi] = i;
auto& [cj, fj, vj] = j;
if (fi ^ fj){
return fi < fj;
} else {
return vi < vj;
}
});
cout << go(0, 0) << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 18
Accepted
time: 0ms
memory: 3584kb
input:
1 3 3253 744 1 1 2012 798
output:
54
result:
ok single line: '54'
Test #2:
score: 18
Accepted
time: 0ms
memory: 3584kb
input:
1 1 2291 728 1 3 3024 858
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
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:
39450
result:
wrong answer 1st lines differ - expected: '368159', found: '39450'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 18
Accepted
Test #18:
score: 18
Accepted
time: 1ms
memory: 3712kb
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:
23934
result:
ok single line: '23934'
Test #19:
score: 18
Accepted
time: 0ms
memory: 3584kb
input:
12 1 2208 8567 1 2221 8626 1 2152 8312 1 2293 8956 1 2261 8809 1 2062 7905 1 2203 8544 1 2105 8099 1 2280 8896 1 2057 7882 1 2015 7693 1 2162 8357 18 1 2563 10209 1 2000 7626 1 3072 12633 1 2789 11276 1 2144 8276 1 2921 11906 1 2380 9357 1 2077 7972 1 2103 8090 1 2868 11652 1 2684 10778 1 3043 12493...
output:
0
result:
ok single line: '0'
Test #20:
score: 18
Accepted
time: 0ms
memory: 4224kb
input:
79 1 4427 4256458 1 3723 3490767 1 3982 3260428 1 3770 3355873 1 4741 4551396 1 5000 1319580 1 4063 2173424 1 2181 4525445 1 3737 1728963 1 3931 4866468 1 4157 4762822 1 4236 1841301 1 2378 2709820 1 4220 2261004 1 2446 4168561 1 4547 2573600 1 3060 2878656 1 4672 4605556 1 2852 3719524 1 4693 42886...
output:
20786601
result:
ok single line: '20786601'
Test #21:
score: 18
Accepted
time: 1ms
memory: 4224kb
input:
79 1 2056 12536 1 2597 8192 1 4936 68413 1 2084 25464 1 2720 34555 1 3791 50555 1 4363 59390 1 4401 14996 1 2332 28967 1 3914 52440 1 4042 13602 1 4057 27320 1 2954 9495 1 4090 13787 1 4478 61188 1 4040 27189 1 3415 22425 1 4636 47751 1 2837 36264 1 4816 33255 1 3383 44370 1 2916 28067 1 3901 52240 ...
output:
237760
result:
ok single line: '237760'
Test #22:
score: 18
Accepted
time: 1ms
memory: 5760kb
input:
224 1 6270 93747369 1 6502 167724928 1 6437 264148706 1 4077 760036221 1 5697 879487623 1 4557 733795468 1 6903 407495462 1 4106 697615090 1 7426 694689028 1 6401 689447791 1 7806 714964788 1 6997 288721199 1 5680 267711948 1 6188 217596834 1 7122 588728375 1 5561 436746734 1 5953 13086744 1 5223 33...
output:
40094608225
result:
ok single line: '40094608225'
Test #23:
score: 18
Accepted
time: 1ms
memory: 5760kb
input:
224 1 5309 28215 1 6848 18732 1 4262 55227 1 4660 48801 1 7916 66044 1 4018 31030 1 5015 26480 1 6577 17908 1 4879 51363 1 7792 86523 1 4023 31073 1 5349 56904 1 4124 10647 1 5126 67834 1 6453 52599 1 7970 44364 1 7728 85732 1 6969 76407 1 6245 33809 1 6330 85806 1 5045 13328 1 6873 18808 1 7161 984...
output:
1397706
result:
ok single line: '1397706'
Test #24:
score: 18
Accepted
time: 2ms
memory: 6400kb
input:
250 1 414892080 475780331 1 389986020 498894352 1 466122353 629641334 1 105791542 964215227 1 108319175 465600284 1 672601741 82971811 1 249420710 401256555 1 149341259 342168603 1 567366454 947578513 1 435092128 806081813 1 780065289 367591037 1 715227604 87185140 1 959201300 62189501 1 257570515 5...
output:
58593606691
result:
ok single line: '58593606691'
Test #25:
score: 18
Accepted
time: 2ms
memory: 6400kb
input:
250 1 139452088 615617196 1 108712470 470545881 1 218593295 999953196 1 200154778 909239851 1 216513655 989690503 1 206416295 939973840 1 101136346 870514051 1 210214974 958655407 1 107570262 465212767 1 114343906 496903861 1 169066882 757820712 1 130284386 572057468 1 178646230 804261003 1 20928398...
output:
11992746282
result:
ok single line: '11992746282'
Subtask #4:
score: 0
Wrong Answer
Test #26:
score: 0
Wrong Answer
time: 0ms
memory: 3456kb
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:
11116
result:
wrong answer 1st lines differ - expected: '17705', found: '11116'
Subtask #5:
score: 0
Wrong Answer
Test #34:
score: 18
Accepted
time: 0ms
memory: 3584kb
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: 18
Accepted
time: 1ms
memory: 4096kb
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:
0
result:
ok single line: '0'
Test #36:
score: 0
Wrong Answer
time: 2ms
memory: 9856kb
input:
570 46 5838 1 40 6425 1 44 5897 1 42 6694 1 49 4775 1 43 6145 1 49 3903 1 46 4661 1 50 5987 1 43 7469 1 40 8641 1 47 7424 1 43 6303 1 44 9446 1 42 9626 1 48 3201 1 46 4829 1 44 7695 1 41 8599 1 48 4502 1 43 7551 1 44 4095 1 50 7648 1 45 5950 1 50 8967 1 42 3801 1 45 4723 1 42 8216 1 47 9791 1 41 586...
output:
0
result:
wrong answer 1st lines differ - expected: '233', found: '0'
Subtask #6:
score: 0
Skipped
Dependency #1:
0%