답안 #156592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156592 2019-10-06T14:43:21 Z a_player Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
 
#define f first
#define s second
#define mp make_pair
#define pb push_back
 
using namespace std;
 
typedef long long ll;
int diff[200001];
pair<int,int> v[200001];
vector<int> find_subset(int l,int u,vector<int> w){
	int N=w.size();
    for(int i=0;i<N;i++){
      v[i].f=w[i];
      v[i].s=i;
    }
	sort(v.begin(),v.end());
	for(int i=0;i<N;i++)diff[i]=v[i].f-v[0].f;
	int h=(u-v[0].f+v[N-1].f)/v[N-1].f;
	int s=h*v[0].f;
	vector<int> sol;
	for(int i=N-1;i>=N-h+1;i--){
		s+=diff[i];
		sol.push_back(v[i].s);
		} 
	for(int i=N-h;i>=0;i--)if(s+diff[i]<=u&&s+diff[i]>=l){
		sol.push_back(v[i].s);
		return sol;
		}
	vector<int> err;
  return err;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:9: error: request for member 'begin' in 'v', which is of non-class type 'std::pair<int, int> [200001]'
  sort(v.begin(),v.end());
         ^~~~~
molecules.cpp:19:19: error: request for member 'end' in 'v', which is of non-class type 'std::pair<int, int> [200001]'
  sort(v.begin(),v.end());
                   ^~~