Submission #819254

#TimeUsernameProblemLanguageResultExecution timeMemory
819254LeVanThucDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define p(x,y) pair<ll,ll>(x,y) #define BIT(i,x) ((x>>i)&1) #define MASK(x) (1<<x) #define ld long double #define __builtin_popcount __builtin_popcountll #define pll pair<ll,ll> template<class T1,class T2> bool maximize(T1 &x,const T2 &y) { if(x<y) { x=y; return 1; } return 0; } template<class T1,class T2> bool minimize(T1 &x,const T2 &y) { if(x>y) { x=y; return 1; } return 0; } void online() { std::ios_base::sync_with_stdio(0); cin.tie(0); //#ifndef ONLINE_JUDGE // freopen("input.inp", "r", stdin); // freopen("output.out","w", stdout); //#else //#endif } const ll M=1e9,N=1e5+10; vector<int> find_subset(int l,int r,vector<int> w) { vector<pll> vt; for(int i=0;i<w.size();i++) { vt.emplace_back(w[i],i); } sort(vt.begin(),vt.end()); ll sum=0; ll j=0; vector<int> res; for(int i=0;i<w.size();i++) { sum+=vt[i].fi; while(sum>r&&j<i) { sum-=vt[j].fi; j++; } if(sum>=l&&sum<=r) { for(int k=j;k<=i;k++) res.push_back(vt[i].se); return res; } } return res; } int main() { }

Compilation message (stderr)

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