Submission #984177

#TimeUsernameProblemLanguageResultExecution timeMemory
984177alphagomasterDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n,u; int l; cin >> n >> l >> u; pair<int,int> w[n]; for(int i = 0 ; i < n;i++){ cin >> w[i].first; w[i].second=i; } sort(w,w+n); int j = 0; int sum = 0; deque<int>v; for(int i = 0; i < n;i++){ v.push_back(w[i].second); sum += w[i].first; while(sum > u){ sum -= w[j].first; j ++; v.pop_front(); } if(sum >= l && sum <= u){ cout << i-j+1 << endl; for(int jj = 0; jj <size(v);jj++){ cout << v[jj]<<" "; } cout << endl; return 0; } } cout << 0 << endl; return 0; }

Compilation message (stderr)

molecules.cpp: In function 'int main()':
molecules.cpp:28:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |       for(int jj = 0; jj <size(v);jj++){
      |                       ~~~^~~~~~~~
/usr/bin/ld: /tmp/ccJkLSmL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccYqzf1M.o:molecules.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccJkLSmL.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