Submission #940197

#TimeUsernameProblemLanguageResultExecution timeMemory
940197viwlesxqCloud Computing (CEOI18_clo)C++17
0 / 100
1 ms348 KiB
#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; }
#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...