Submission #434908

#TimeUsernameProblemLanguageResultExecution timeMemory
434908ToroTNDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include "molecules.h" long long it=-1,sum=0,type; vector<long long> emptyvec; vector<pair<long long,long long> > v; std::vector<long long> find_subset(long long l, long long u, std::vector<long long> w) { for(int i=0;i<w.size();i++) { v.push_back(make_pair(w[i],i)); } for(int i=0;i<v.size();i++) { sum+=v[i].first; if(sum>=l) { if(sum<=u) { for(int j=0;j<=i;j++) { emptyvec.push_back(v[j].second); } return emptyvec; } it=i; break; } } if(it==-1) { return emptyvec; } for(int i=1;i<v.size();i++) { type=-1; sum-=v[i-1].first; if(sum>=l) { if(sum<=u) { for(int j=i-1;j<=it;j++) { emptyvec.push_back(v[j].second); } return emptyvec; } continue; } for(int j=it+1;j<v.size();j++) { sum+=v[j].first; if(sum>=l) { if(sum<=u) { for(int k=i;i<=j;i++) { emptyvec.push_back(v[k].second); } return emptyvec; } type=0; break; } } if(type==-1) { return emptyvec; } } return emptyvec; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=0;i<w.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=1;i<v.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for(int j=it+1;j<v.size();j++)
      |                        ~^~~~~~~~~
/usr/bin/ld: /tmp/ccjBayf5.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status