Submission #69045

# Submission time Handle Problem Language Result Execution time Memory
69045 2018-08-19T15:13:44 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<w.size();i++){
		if(s+w[i].ff<=u){
			s+=w[i].ff;
			ans1.pub(mp(w[i].ff,w[i].ss));
		}
		else if(s-ans1[0].ff+w[i].ff<=u){
			s-=ans1[0].ff-w[i].ff;
			asn1.pop_front();
			ans1.pub(mp(w[i].ff,w[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<w.size();i++){
          ~^~~~~~~~~
molecules.cpp:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:20:13: note: in expansion of macro 'ff'
   if(s+w[i].ff<=u){
             ^~
molecules.cpp:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:21:12: note: in expansion of macro 'ff'
    s+=w[i].ff;
            ^~
molecules.cpp:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:22:21: note: in expansion of macro 'ff'
    ans1.pub(mp(w[i].ff,w[i].ss));
                     ^~
molecules.cpp:7:12: error: request for member 'second' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ss second
            ^
molecules.cpp:22:29: note: in expansion of macro 'ss'
    ans1.pub(mp(w[i].ff,w[i].ss));
                             ^~
molecules.cpp:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:24:29: note: in expansion of macro 'ff'
   else if(s-ans1[0].ff+w[i].ff<=u){
                             ^~
molecules.cpp:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:25:23: note: in expansion of macro 'ff'
    s-=ans1[0].ff-w[i].ff;
                       ^~
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:8:12: error: request for member 'first' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ff first
            ^
molecules.cpp:27:21: note: in expansion of macro 'ff'
    ans1.pub(mp(w[i].ff,w[i].ss));
                     ^~
molecules.cpp:7:12: error: request for member 'second' in 'w.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
 #define ss second
            ^
molecules.cpp:27:29: note: in expansion of macro 'ss'
    ans1.pub(mp(w[i].ff,w[i].ss));
                             ^~
molecules.cpp:30:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<ans1.size();i++){
          ~^~~~~~~~~~~~