제출 #1175472

#제출 시각아이디문제언어결과실행 시간메모리
1175472Dan4LifeCloud Computing (CEOI18_clo)C++20
100 / 100
500 ms1352 KiB
#include <bits/stdc++.h> using namespace std; const int N = 100001; long long n,c,f,v,dp[N]; vector<array<long long,4>> a; main(){ for(int t:{-1,1}){ cin >> n; while(n--) cin>>c>>f>>v, a.push_back({-f,t,c*t,v*t}); } sort(begin(a),end(a)); fill(dp+1,dp+N,-2e18); for(auto [f,t,c,v] : a) for(int j = t==1?0:N-1; t==1?j+c<N:j>=-c; j+=t) dp[j] = max(dp[j], dp[j+c]+v); cout << *max_element(dp,dp+N) << "\n"; }

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

clo.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
#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...