Submission #624278

#TimeUsernameProblemLanguageResultExecution timeMemory
624278VovamatrixDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
//https://oj.uz/problem/view/IOI16_molecules #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define pb push_back #define mp make_pair #define mt make_tuple #define fi first #define sc second #define th third #define fo fourth #define pii pair<int,int> #define pll pair<ll,ll> #define ldb double #define endl "\n" #define all(data) data.begin(),data.end() #define TYPEMAX(type) std::numeric_limits<type>::max() #define TYPEMIN(type) std::numeric_limits<type>::min() #define MAXN 200007 ll w[MAXN]; ll prefsum[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n,l,u; cin>>n>>l>>u; for(int i=1;i<=n;i++) cin>>w[i]; sort(w+1,w+n+1); prefsum[0]=0; for(int i=1;i<=n;i++) prefsum[i]=prefsum[i-1]+w[i]; ll itr1=0,itr2=1; bool check=false; while(itr2<=n) { if(prefsum[itr2]-prefsum[itr1]>u) itr1++; else if(prefsum[itr2]-prefsum[itr1]<l) itr2++; else { for(int i=itr1+1;i<=itr2;i++) cout<<w[i]<<" "; check=true; break; } } return 0; }

Compilation message (stderr)

molecules.cpp: In function 'int main()':
molecules.cpp:35:10: warning: variable 'check' set but not used [-Wunused-but-set-variable]
   35 |     bool check=false;
      |          ^~~~~
/usr/bin/ld: /tmp/ccXUgTc3.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoq2xK2.o:molecules.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccXUgTc3.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