답안 #112327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112327 2019-05-18T18:31:22 Z ioilolcom Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 384 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long int

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	vector<pair<int,int> > ww;
	for(int i=0; i<(int)w.size(); i++) {
		ww.push_back({w[i],i});
	}
	sort(ww.begin(),ww.end());
	vector<int> ans;
	int n=(int)w.size();
	int b=0;

	ll sum=0;
	for(int a=0; a<n; a++) {
		sum+=ww[a].x;
		while(sum>u) {
			sum-=ww[b++].x;
		}
		if(sum>=l) {
			for(int k=b; k<=a; k++) {
				ans.push_back(ww[k].y);
				return ans;
			}
		}
	}

	return std::vector<int>(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB sum of weights should be in [302..304] but it is 50
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB sum of weights should be in [100..100] but it is 50
5 Halted 0 ms 0 KB -