제출 #464243

#제출 시각아이디문제언어결과실행 시간메모리
464243wdjpngCloud Computing (CEOI18_clo)C++17
0 / 100
120 ms262148 KiB
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i<n; i++) #define all(a) a.begin(), a.end() using namespace std; signed main() { int n,m,x; int f[n], v[n]; cin>>n; rep(i,n) cin >> x >> f[i] >> v[i]; cin>>m; int F[m], V[m]; rep(i,m) cin >> x >> F[i] >> V[i]; int dp[n][m]; rep(i,n) { rep(j,m) { dp[i][j] = 0; if (i>0) dp[i][j] = max(dp[i][j], dp[i-1][j]); if (j>0) dp[i][j] = max(dp[i][j], dp[i][j-1]); if(i>0&j>0&f[i]>=F[j]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + V[i] - v[i]); } } cout << dp[n-1][m-1] << "\n"; }

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

clo.cpp: In function 'int main()':
clo.cpp:25:17: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   25 |             if(i>0&j>0&f[i]>=F[j]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + V[i] - v[i]);
      |                ~^~
clo.cpp:25:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   25 |             if(i>0&j>0&f[i]>=F[j]) dp[i][j] = max(dp[i][j], dp[i-1][j-1] + V[i] - v[i]);
      |                        ~~~~^~~~~~
clo.cpp:10:12: warning: 'n' is used uninitialized in this function [-Wuninitialized]
   10 |     int f[n], v[n];
      |            ^
#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...