제출 #785094

#제출 시각아이디문제언어결과실행 시간메모리
785094khshg메기 농장 (IOI22_fish)C++17
0 / 100
22 ms3924 KiB
#include<bits/stdc++.h> using namespace std; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { long long ans = 0; vector<int> c(N); for(int i = 0; i < M; ++i) { c[X[i]] = W[i]; } vector<array<long long, 2>> dp(N); dp[0][0] = 0; dp[0][1] = c[0]; for(int i = 1; i < N; ++i) { dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]); dp[i][1] = dp[i - 1][0] + c[i]; } return max(dp.back()[0], dp.back()[1]); }

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

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:5:12: warning: unused variable 'ans' [-Wunused-variable]
    5 |  long long ans = 0;
      |            ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...