Submission #134654

#TimeUsernameProblemLanguageResultExecution timeMemory
134654MuhammetaliDetecting Molecules (IOI16_molecules)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll n,l,u,w[1001],m,e[1001],jem,h[1001],g,k,res; int Lay(ll h[],ll e[],ll w[],ll g,ll k) { for (int i=0;i<n;i++) { if (w[i]==h[k]) { w[i]=0; e[g]=i; return 0; } } } int main() { system("color 7E"); ios::sync_with_stdio(0); cin.tie(0); cin >> n >> l >> u; for (ll i=0;i<n;i++) { cin >> w[i]; res+=w[i]; h[i]=w[i]; } sort(h,h+n); if (u-l>=h[n-1]-h[0]) { if (res<l) { cout << 0; return 0; } if (res<l) { cout << 0; return 0; } if (h[0]>=l && h[0]<=u && h[0]+h[1]>u) { cout << 1 << endl; cout << 0; return 0; } for (ll i=n-1;i>=0;i--) { jem+=h[i]; k=i; if (jem<=u) { g++; Lay(h,e,w,g,k); } if (jem>u) { jem-=h[i]; } } } else { cout << 0; return 0; } if (jem<l) { cout << 0; return 0; } cout << g << endl; sort (e+1,e+g+1); for (ll i=1;i<=g;i++) { cout << e[i] << " "; } }

Compilation message (stderr)

molecules.cpp: In function 'int Lay(ll*, ll*, ll*, ll, ll)':
molecules.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
molecules.cpp: In function 'int main()':
molecules.cpp:25:8: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
  system("color 7E");
  ~~~~~~^~~~~~~~~~~~
/tmp/ccccpeW5.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccsHlAPQ.o:molecules.cpp:(.text.startup+0x0): first defined here
/tmp/ccccpeW5.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status