답안 #72931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72931 2018-08-27T09:07:31 Z FedericoS Detecting Molecules (IOI16_molecules) C++14
0 / 100
3 ms 584 KB
#include <algorithm>
#include "molecules.h"
using namespace std;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {

	vector<int> V;
	int N=w.size();
	int S=0;
	vector<pair<int,int>> W;

	for(int i=0;i<N;i++)
		W.push_back({w[i],i});
	sort(W.begin(), W.end());

    for(int a=0,b=0;a<N;a++){
    	S-=a?W[a-1].first:0;
    	while(l>S and b<N)
    		S+=W[b++].first;
    	if(S<=u){
    		for(int i=a;i<b;i++)
    			V.push_back(W[i].second);
    		return V;
    	}
    }

    return V;

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 360 KB OK (n = 12, answer = YES)
2 Correct 3 ms 564 KB OK (n = 12, answer = YES)
3 Incorrect 2 ms 584 KB sum of weights should be in [307..317] but it is 306
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -