#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define size(x) (int)x.size()
template<class S, class T>
bool chmin(S &a, const T &b) {
return a > b ? (a = b) == b : false;
}
template<class S, class T>
bool chmax(S &a, const T &b) {
return a < b ? (a = b) == b : false;
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n; cin >> n;
int c[n], f[n], v[n];
for (int i = 0; i < n; ++i) {
cin >> c[i] >> f[i] >> v[i];
}
int m; cin >> m;
vector<array<int, 3>> vec(m);
for (int i = 0; i < m; ++i) {
cin >> vec[i][2] >> vec[i][0] >> vec[i][1];
}
sort(all(vec));
int res = 0;
while (!vec.empty()) {
int V = vec.back()[1], F = vec.back()[0];
int Max = 0;
for (int i = 0; i < n; ++i) {
if (c[i] && f[i] >= F && v[i] <= V) {
chmax(Max, v[i]);
}
}
res += Max;
for (int i = 0; i < n; ++i) {
if (c[i] && f[i] >= F && v[i] == Max) {
c[i]--;
break;
}
}
vec.pop_back();
}
cout << res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |