제출 #1006270

#제출 시각아이디문제언어결과실행 시간메모리
1006270Owen11Cloud Computing (CEOI18_clo)C++14
100 / 100
302 ms1476 KiB
#include <bits/stdc++.h> using namespace std; # define int long long # define fir first # define sec second # define pb push_back # define endl "\n" const int cnst = 1e5+55; bool mutipletestcase = 0; //bool debug = false; bool sorting(tuple<int, int, int, bool> a, tuple<int, int, int, bool> b) { auto[a1, a2, a3, a4] = a; auto[b1, b2, b3, b4] = b; if(a1 == b1) return a4 > b4; return a1 < b1; } void solve() { int n; cin >> n; vector<tuple<int, int, int, bool>> vec; for(int i = 1; i<=n; i++) { int a, b, c; cin >> a >> b >> c; vec.pb({b, a, c, 0}); } int m; cin >> m; for(int i = 1; i<=m; i++) { int a, b, c; cin >> a >> b >> c; vec.pb({b, a, c, 1}); } sort(vec.begin(), vec.end(), sorting); reverse(vec.begin(), vec.end()); int dp[cnst]; dp[0] = 0; for(int i = 1; i<=1e5; i++) dp[i] = 1e18*-1; for(auto [pow, fre, cos, id]: vec) { if(!id) { for(int i = 1e5; i>=fre; i--) dp[i] = max(dp[i], dp[i-fre]-cos); } else { for(int i = 0; i<=1e5-fre; i++) dp[i] = max(dp[i], dp[i+fre]+cos); } // for(int i = 1; i<=10; i++) cerr << dp[i] << " "; cerr << endl; } int ans = 0; for(int i = 0; i<=1e5; i++) ans = max(ans, dp[i]); cout << ans << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; if(mutipletestcase) cin >> t; while(t--) solve(); }

컴파일 시 표준 에러 (stderr) 메시지

clo.cpp: In function 'bool sorting(std::tuple<long long int, long long int, long long int, bool>, std::tuple<long long int, long long int, long long int, bool>)':
clo.cpp:15:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   15 |     auto[a1, a2, a3, a4] = a;
      |         ^
clo.cpp:16:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     auto[b1, b2, b3, b4] = b;
      |         ^
clo.cpp: In function 'void solve()':
clo.cpp:44:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   44 |     for(auto [pow, fre, cos, id]: vec) {
      |              ^
#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...