Submission #297754

#TimeUsernameProblemLanguageResultExecution timeMemory
297754emnikDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define pb push_back #define all(x) begin(x), end(x) #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int find_subsets(int l, int r, int w[], int n, int result[]){ vector<int> a, b; for(int i=1; i <= n; i++){ int sum=w[i], flag=0; a.clear(); a.pb(i); for(int j=i+1; j <= n; j++){ if(sum >= l && sum <= r){ flag=1; break; } sum+= w[j]; a.pb(j); } if(flag) b = a; } for(int i=0; i < b.size(); i++){ result[i+1]=b[i]; } return (int)b.size(); }

Compilation message (stderr)

molecules.cpp: In function 'int find_subsets(int, int, int*, int, int*)':
molecules.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0; i < b.size(); i++){
      |                  ~~^~~~~~~~~~
/tmp/ccelwZIZ.o: In function `main':
grader.cpp:(.text.startup+0x12b): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status