제출 #851567

#제출 시각아이디문제언어결과실행 시간메모리
851567askowDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 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(); set<int>s; for(int i=0;i<n;i++)s.insert(w[i]); if(n<=100&&s.size()==1){ int pref[n]; pref[0]=a[0]; for(int i=1;i<n;i++)pref[i]=pref[i-1]+w[i]; vector<int>ans; for(int i=0;i<n;i++){ for(int j=i;j<n;j++){ int C=-1; if(i==0)C=pref[j]; else C=pref[j]-pref[i-1]; if(C>=l&&C<=u){ for(int k=i;k<=j;k++)ans.push_back(k); return ans; } } } return {}; } }/* signed main(){ ios::sync_with_stdio(false); cin.tie(0); 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:10:17: error: 'a' was not declared in this scope
   10 |         pref[0]=a[0];
      |                 ^
molecules.cpp:6:13: warning: control reaches end of non-void function [-Wreturn-type]
    6 |     set<int>s;
      |             ^