제출 #479931

#제출 시각아이디문제언어결과실행 시간메모리
479931tphuc2908Cloud Computing (CEOI18_clo)C++14
72 / 100
1930 ms2040 KiB
#include<bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") //#pragma GCC optimization ("unroll-loops") #define rep(i, x, y) for(int i = x; i <= y; ++i) #define repi(i,x,y) for(int i = x; i >= y; --i) #define ci(x) int x; cin>> x #define TC(t) ci(t); while(t--) #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define cii(x, y) ci(x); ci(y) #define ciii(x, y, z) ci(x); ci(y); ci(z) #define mp make_pair #define int long long typedef long long ll; typedef vector<int> vi; const int N = 40 + 5; const int mod = 1e9 + 7; const int mod1 = 1e9 + 9; const int pi = 31, pii = 29, piii = 41; const int inf = 1e15 + 5; const int block = 330; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; void readfile(){ #ifdef ONLINE_JUDGE #else freopen("text.inp", "r", stdin); #endif // ONLINE_JUDGE // freopen("mooriokart.in", "r", stdin); // freopen("mooriokart.out", "w", stdout); } int n, m; struct info{ int c, f, v; } a[4005]; void inp(){ cin >> n; rep(i,1,n){ cin >> a[i].c >> a[i].f >> a[i].v; a[i].v *= -1; } cin >> m; rep(i,n+1,n+m){ cin >> a[i].c >> a[i].f >> a[i].v; a[i].c *= -1; } sort(a + 1, a + n + m + 1, [](const info &x, const info &y){return x.f > y.f;}); } vector<ll> dp_before, dp_after; void process(){ dp_before.resize(100005, -inf); dp_after = dp_before; dp_before[0] = 0; rep(i,1,n+m){ rep(j,0,100000){ dp_after[j] = max(dp_after[j], dp_before[j]); if(j + a[i].c >= 0 && j + a[i].c <= 100000) dp_after[j + a[i].c] = max(dp_after[j + a[i].c], dp_before[j] + a[i].v); } dp_before = dp_after; dp_after.assign(100005, -inf); } cout << *max_element(all(dp_before)); } main() { // readfile(); ios_base::sync_with_stdio(false); cin.tie(NULL); // TC(t){ inp(); process(); // } return 0; }

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

clo.cpp:76:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   76 |  main() {
      |  ^~~~
clo.cpp: In function 'void readfile()':
clo.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen("text.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...