제출 #851280

#제출 시각아이디문제언어결과실행 시간메모리
851280askowDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms412 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=w.size(); int subtask1=0; set<int>s; for(int i=0;i<n;i++)s.insert(w[i]); int C=0; for(int i=0;i<n;i++)C+=w[i]; if(C<l)return {}; if(s.size()==1)subtask1=1; if(subtask1){ int sum=0; vector<int>ans; for(int i=0;i<n;i++){ if(sum+w[i]>u)break; sum+=w[i]; ans.push_back(i); } return ans; } }/* int main(){ int n,u,v; cin>>n>>u>>v; vector<int>a(n); for(int i=0;i<n;i++)cin>>a[i]; for(auto it:find_subset(u,v,a))cout<<it<<" "; }*/

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:13: warning: control reaches end of non-void function [-Wreturn-type]
    7 |     set<int>s;
      |             ^
#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...