Submission #260415

# Submission time Handle Problem Language Result Execution time Memory
260415 2020-08-10T08:39:34 Z Bill_00 Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
using namespace std;
pair<int,int>p[200002]
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    for(int i=1;i<=n;i++){
		p[i]=mp(w[i],i);
	} 
	sort(p+1,p+n+1);
	vector<int>res;
	ll sum=0,id=0;
	for(int i=1;i<=n;i++){
		sum+=p[i].ff;
		if(sum>=l && sum<=u){
			for(int j=1;j<=i;j++){
				res.push_back(p[i].ss);
			}
			return res;
		}
		if(sum>=l){
			sum-=p[i].ff;
			id=i-1;
			break;
		}
	}
	//cout << id << endl;
	if(id==0){
		return res;
	}
	for(int i=id;i>=1;i--){
		sum=sum-p[i].ff;
		sum=sum+p[i+n-id].ff;
		//cout << sum << endl;
		if(sum>=l){
			for(int j=1;j<i;j++){
				res.push_back(p[j].ss);
			}
			for(int j=i+n-id;j<=n;j++){
				res.push_back(p[j].ss);
			}
			return res;
		}
	}
	return res;
}

Compilation message

molecules.cpp:8:1: error: expected initializer before 'std'
 std::vector<int> find_subset(int l, int u, std::vector<int> w) {
 ^~~