제출 #824872

#제출 시각아이디문제언어결과실행 시간메모리
824872alvingogo메기 농장 (IOI22_fish)C++17
9 / 100
35 ms12376 KiB
#include "fish.h" #include <bits/stdc++.h> #define fs first #define sc second #define p_q priority_queue using namespace std; const long long inf=1e16; long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) { long long ans=0; vector<vector<pair<int,int> > > v(n); vector<int> q(n); for(int i=0;i<m;i++){ v[x[i]].push_back({y[i],w[i]}); q[x[i]]=w[i]; } vector<array<long long,3> > dp(n); for(int i=0;i<n;i++){ dp[i][0]=dp[i][1]=dp[i][2]=0; } dp[0][2]=-inf; for(int i=1;i<n;i++){ dp[i][0]=max({dp[i-1][0],dp[i-1][1]+q[i-1],dp[i-1][2]}); dp[i][1]=max({dp[i-1][1],dp[i-1][2]}); dp[i][2]=dp[i-1][0]+q[i]; } return max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}); }

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

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:10:15: warning: unused variable 'ans' [-Wunused-variable]
   10 |     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...