제출 #761129

#제출 시각아이디문제언어결과실행 시간메모리
761129AloraCloud Computing (CEOI18_clo)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #define name "cownav" #define fi(i,a,b) for(int i = a; i <= b; i++) #define fid(i,a,b) for(int i = a; i >= b; i--) #define ll long long #define ft first #define se second #define pii pair<int, int> #define getbit(i, j) ((i >> j) & 1) #define pb push_back #define maxn 2003 using namespace std; int n, m; struct dl{ int c, f, v; bool operator < (const dl &o) const { if(f == o.f) return v > o.v; return f < o.f; } }a[maxn], b[maxn]; int nc, mc, nv, mv, nf, mf; ll res, dp[maxn][maxn]; void sub3(){ sort(a + 1, a + n + 1); sort(b + 1, b + m + 1); fi(j, 1, m){ fi(i, 1, n) if(a[i].f >= b[j].f){ int money = b[j].v - a[i].v; if(money <= 0) continue; dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + money); dp[i][j] = max({dp[i][j], dp[i][j - 1], dp[i - 1][j]}); res = max(res, dp[i][j]); } } cout << res; exit(0); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); //freopen(name".in", "r", stdin); //f/reopen(name".out", "w", stdout); cin >> n; fi(i, 1, n){ int c, f, v; cin >> c >> f >> v; a[i] = {c, f, v}; nc = max(nc, c); nf = max(nf, f); nv = max(nv, v); } cin >> m; fi(i, 1, m){ int c, f, v; cin >> c >> f >> v; b[i] = {c, f, v}; mc = max(mc, c); mf = max(mf, f); mv = max(mv, v); } if(n <= 250 && m <= 250 && nc == 1 && mc == 1) sub3(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...