제출 #470841

#제출 시각아이디문제언어결과실행 시간메모리
470841cookiemonster04Cloud Computing (CEOI18_clo)C++17
72 / 100
440 ms2116 KiB
#include<bits/stdc++.h> using namespace std; #define LL long long #define pb push_back #define NINF -1000000000000000LL; /* Date: 9/5/21 * Link: https://oj.uz/problem/view/CEOI18_clo * Verdict: */ struct Option { int c, f, v; Option(int _c, int _f, int _v) { c = _c; f = _f; v = _v; } inline bool operator<(const Option& o) { if (f != o.f) { return f > o.f; } return v < o.v; } }; vector<Option> options; LL dp[2][100005]; int N, M; int main() { ios::sync_with_stdio(0); #pragma omp parallel for for (int i = 0; i < 100005; i++) { dp[0][i] = NINF; dp[1][i] = NINF; } cin >> N; for (int i = 0; i < N; i++) { int c, f, v; cin >> c >> f >> v; options.push_back(Option(c, f, -v)); } cin >> M; for (int i = 0; i < M; i++) { int c, f, v; cin >> c >> f >> v; options.push_back(Option(-c, f, v)); } sort(options.begin(), options.end()); int crow = 0; int rrow = 1; const int len = N+M; dp[0][0] = 0; for (int i = 0; i < len; i++) { const int cc = options[i].c; const int cv = options[i].v; const int lim = min(100000, 100000+cc); const int start = max(0, cc); #pragma omp parallel for for (int j = start; j <= lim; j++) { dp[rrow][j] = max(dp[crow][j], dp[crow][j-cc]+cv); } for (int j = 0; j < start; j++) { dp[rrow][j] = dp[crow][j]; } for (int j = lim+1; j <= 100000; j++) { dp[rrow][j] = dp[crow][j]; } crow = rrow; rrow = 1 ^ rrow; } LL ans = 0; for (int i = 0; i < len; i++) { ans = max(ans, dp[crow][i]); } cout << ans << endl; }

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

clo.cpp:29: warning: ignoring '#pragma omp parallel' [-Wunknown-pragmas]
   29 |     #pragma omp parallel for
      | 
clo.cpp:56: warning: ignoring '#pragma omp parallel' [-Wunknown-pragmas]
   56 |         #pragma omp parallel for
      |
#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...