Submission #134853

# Submission time Handle Problem Language Result Execution time Memory
134853 2019-07-23T10:23:44 Z reda Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
vector<int>find_subset(int l, int u, vector<int> w)
{
      vector<pair<int,int>>v;
vector<int> ans;
      int n = w.size();
      for(int i=0;i<n;i++)
        v.pb(mp(w[i],i));
    if(v[0].fi>u)return ans;
    for(int i=0;i<n;i++)
    {
         int sum=v[i].fi;
         vector<int> hh;
         hh.pb(v[i].se);
        for(int j=0;j<n;j++)
         {
             if(i==j)continue;
             if(sum+v[j].fi>u)break;
             sum+=v[j].fi;
             hh.pb(v[j].se);
         }
         if(sum>=l)return hh;
    }
 }
int main ()
{
    return 0;
}#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
vector<int>find_subset(int l, int u, vector<int> w)
{
      vector<pair<int,int>>v;
vector<int> ans;
      int n = w.size();
      for(int i=0;i<n;i++)
        v.pb(mp(w[i],i));
    if(v[0].fi>u)return ans;
    for(int i=0;i<n;i++)
    {
         int sum=v[i].fi;
         vector<int> hh;
         hh.pb(v[i].se);
        for(int j=0;j<n;j++)
         {
             if(i==j)continue;
             if(sum+v[j].fi>u)break;
             sum+=v[j].fi;
             hh.pb(v[j].se);
         }
         if(sum>=l)return hh;
    }
 }
/*int main ()
{
    return 0;
}*/

Compilation message

molecules.cpp:33:2: error: stray '#' in program
 }#include<bits/stdc++.h>
  ^
molecules.cpp:33:3: error: 'include' does not name a type
 }#include<bits/stdc++.h>
   ^~~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:39:12: error: redefinition of 'std::vector<int> find_subset(int, int, std::vector<int>)'
 vector<int>find_subset(int l, int u, vector<int> w)
            ^~~~~~~~~~~
molecules.cpp:7:12: note: 'std::vector<int> find_subset(int, int, std::vector<int>)' previously defined here
 vector<int>find_subset(int l, int u, vector<int> w)
            ^~~~~~~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:29:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:61:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^