Submission #866678

#TimeUsernameProblemLanguageResultExecution timeMemory
866678maks007Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include "bits/stdc++.h" #include "grader.cpp" using namespace std; const int N = (int)1e5+1; int dp[N], path[N]; vector<int> find_subset(int l, int r, vector<int> a) { // cout << "DSKDJ:ASKLDJ:AS"; vector <int> ans; for(int i = 0; i < N; i ++) path[i] = -1, dp[i] = 0; dp[0] = 1; path[0] = -1; for(int coin = 0; coin < a.size(); coin ++) { // cout << coin << " "; for(int j = N-1; j >= 0; j --) { if(j-a[coin] >= 0) { if(dp[j-a[coin]]) { dp[j] |= dp[j-a[coin]]; path[j] = coin; } } } } for(int i = l; i <= r; i ++) { if(dp[i]) { for(int u = i;;) { if(path[u] == -1) break; ans.push_back(path[u]); u -= a[path[u]]; } return ans; } } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int coin = 0; coin < a.size(); coin ++) {
      |                       ~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccwVukO9.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwDDAK9.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status