제출 #1038463

#제출 시각아이디문제언어결과실행 시간메모리
1038463Marco_Escandon메기 농장 (IOI22_fish)C++17
3 / 100
100 ms36704 KiB
#include<bits/stdc++.h> using namespace std; //#include "fish.h" typedef long long ll; #define x first #define y second long long max_weights(int n, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> w) { vector<vector<pair<ll,ll>>> cad(n+1); vector<vector<ll>> sol(n+1),sol2(n+1); for(int i=0; i<X.size(); i++) cad[X[i]+1].push_back({Y[i]+1,w[i]}); for(int i=0; i<cad.size(); i++) { cad[i].push_back({0,0}); sort(cad[i].begin(),cad[i].end()); cad[i].push_back({1e9,0}); for(int j=1; j<cad[i].size(); j++) cad[i][j].y+=cad[i][j-1].y; sol[i].resize(cad[i].size()); sol2[i].resize(cad[i].size()); } sol[0][0]=0; sol[0][1]=0; sol2[0][0]=0; sol2[0][1]=0; for(int i=1; i<sol.size(); i++) { ll p=0; for(int j=0; j<sol[i].size(); j++) { while(p<cad[i-1].size()&&cad[i-1][p]<=cad[i][j]) p++; p--; sol[i][j]=max(sol[i][j],sol2[i-1][p]+cad[i-1][p].y); if(i>=3) sol[i][j]=max(sol[i][j],sol[i-2].back()+cad[i-1].back().y); } for(int j=0; j<sol[i].size(); j++) { sol2[i][j]=sol[i][j]-cad[i][j].y; if(j>=1) { sol2[i][j]=max(sol2[i][j],sol2[i][j-1]); sol[i][j]=max(sol[i][j],sol[i][j-1]); } } } return sol.back().back(); }

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

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0; i<X.size(); i++)
      |                  ~^~~~~~~~~
fish.cpp:12:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0; i<cad.size(); i++)
      |                  ~^~~~~~~~~~~
fish.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int j=1; j<cad[i].size(); j++)
      |                      ~^~~~~~~~~~~~~~
fish.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=1; i<sol.size(); i++)
      |                  ~^~~~~~~~~~~
fish.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int j=0; j<sol[i].size(); j++)
      |                      ~^~~~~~~~~~~~~~
fish.cpp:31:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             while(p<cad[i-1].size()&&cad[i-1][p]<=cad[i][j]) p++;
      |                   ~^~~~~~~~~~~~~~~~
fish.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(int j=0; j<sol[i].size(); j++)
      |                      ~^~~~~~~~~~~~~~
#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...