Submission #69046

# Submission time Handle Problem Language Result Execution time Memory
69046 2018-08-19T15:14:55 Z TuGSGeReL Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
int i;
ll s;
vector<pair<int,int> >v;
vector<int> find_subset(int l, int u, vector<int> w) {
	for(i=0;i<w.size();i++) v.pub(mp(w[i],i));
	sort(w.begin(),w.end());
	deque<pair<int,int> >ans1;
	vector<int>ans;
	for(i=0;i<v.size();i++){
		if(s+v[i].ff<=u){
			s+=v[i].ff;
			ans1.pub(mp(v[i].ff,v[i].ss));
		}
		else if(s-ans1[0].ff+v[i].ff<=u){
			s-=ans1[0].ff-v[i].ff;
			asn1.pop_front();
			ans1.pub(mp(v[i].ff,v[i].ss));
		}
	}
	for(i=0;i<ans1.size();i++){
		ans.pub(ans1[i].ss);
	}
	return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<w.size();i++) v.pub(mp(w[i],i));
          ~^~~~~~~~~
molecules.cpp:19:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<v.size();i++){
          ~^~~~~~~~~
molecules.cpp:26:4: error: 'asn1' was not declared in this scope
    asn1.pop_front();
    ^~~~
molecules.cpp:26:4: note: suggested alternative: 'ans'
    asn1.pop_front();
    ^~~~
    ans
molecules.cpp:30:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<ans1.size();i++){
          ~^~~~~~~~~~~~