답안 #172335

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172335 2020-01-01T09:59:05 Z mohammad Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
 
#include<bits/stdc++.h>
#include "molecules.h"
using namespace std;
 
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;

vector<pair<int,int>> v;
ll sum = 0 ;
vector<int> ans;

vector<int> find_subset(int l, int u, vector<int> w) {
	int idx = 0;
	for(int i = 0 ; i < w.size() ; ++i) v.push_back({w[i] , i});
	sort(v.begin(), v.end());
	for(int i = 0 ; i < w.size() ; ++i){
		sum += u ;
		while(sum > u) sum -= v[idx++].first;
		if(sum >= l){
			for(int j = idx ; j <= i ; ++j) ans.push_back(j + 1);
			return;
		}
	}
	return ans;    
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; ++i) v.push_back({w[i] , i});
                  ~~^~~~~~~~~~
molecules.cpp:37:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; ++i){
                  ~~^~~~~~~~~~
molecules.cpp:42:4: error: return-statement with no value, in function returning 'std::vector<int>' [-fpermissive]
    return;
    ^~~~~~