Submission #999327

#TimeUsernameProblemLanguageResultExecution timeMemory
999327vuhDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define inf INT_MAX std::vector<int> find_subset(int l, int u, std::vector<int> w){ int n = w.size(),mini = int,maxi = -inf,x = u - l,sum = 0; for(int i =0;i<n ;i++){ mini = min(mini,w[i]); maxi = max(maxi,w[i]); sum += w[i]; } vector <int> ans; if(maxi - mini > x){ return vector <int> (0); } while(!next_permutation(w.begin(),w.end())){ for(int i =0;i<n ;i++){ sum = 0; for(int j =0;j<=i ;j++){ sum += w[i]; } if((sum >= l && sum <= u) || (sum <= l && sum >= u)){ for(int j =0;j<=i ;j++){ ans.push_back(a[i]); } return ans; } } } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:29: error: expected primary-expression before 'int'
    7 |     int n = w.size(),mini = int,maxi = -inf,x = u - l,sum = 0;
      |                             ^~~
molecules.cpp:10:9: error: 'maxi' was not declared in this scope
   10 |         maxi = max(maxi,w[i]);
      |         ^~~~
molecules.cpp:11:9: error: 'sum' was not declared in this scope
   11 |         sum += w[i];
      |         ^~~
molecules.cpp:14:8: error: 'maxi' was not declared in this scope
   14 |     if(maxi - mini > x){
      |        ^~~~
molecules.cpp:14:22: error: 'x' was not declared in this scope
   14 |     if(maxi - mini > x){
      |                      ^
molecules.cpp:19:13: error: 'sum' was not declared in this scope
   19 |             sum = 0;
      |             ^~~
molecules.cpp:25:35: error: 'a' was not declared in this scope
   25 |                     ans.push_back(a[i]);
      |                                   ^
molecules.cpp:13:18: warning: control reaches end of non-void function [-Wreturn-type]
   13 |     vector <int> ans;
      |                  ^~~