제출 #683160

#제출 시각아이디문제언어결과실행 시간메모리
683160JuanDetecting Molecules (IOI16_molecules)C++14
0 / 100
1096 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int, int> #define ff first #define ss second vector<int> ans; vector<pii> arr; int ll, uu; bool dp(int id, int sum){ if(sum>uu) return false; if(sum>=ll && sum<=uu) return true; for(int i = id; i < arr.size(); i++){ if(dp(i+1, sum+arr[i].ff)){ ans.push_back(arr[i].ss); return true; } } return false; } vector<int> find_subset(int l, int u, vector<int> w){ ll = l, uu = u; for(int i = 0; i < w.size(); i++) arr.push_back({w[i], i}); sort(arr.begin(), arr.end(), greater<pii>()); dp(0, 0); return ans; }

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

molecules.cpp: In function 'bool dp(int, int)':
molecules.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i = id; i < arr.size(); i++){
      |                  ~~^~~~~~~~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for(int i = 0; i < w.size(); i++) arr.push_back({w[i], i});
      |                 ~~^~~~~~~~~~
#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...