답안 #299628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299628 2020-09-15T11:08:58 Z Valee Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 416 KB
#include "molecules.h"
#include <bits/stdc++.h>

#define ll long long

using namespace std;

vector<int> find_subset(int l, int u, vector<int> v) {
	bool ok = false;
	vector<int>ans;
	int n = (int)v.size();
	sort(v.begin(), v.end());
	int lb = 0, rb = n+1, lans = 0, rans = 0;
	while (lb < rb && !ok){
		ll m = (lb+rb)>>1, sum = 0;
		for (int i = 0; i < n; i++){
			if (i < m) sum += v[i];
			else sum += v[i]-v[i-m];
			if (l <= sum && sum <= u){
				lans = max(0LL, i-m+1); rans = i;
				ok = true;
				break;
			}
		}
		if (sum >= u) rb = m;
		else lb = m+1;
	}
	ll sum = 0;
	if (ok){
		for (int i = lans; i <= rans; i++){
			sum += ans[i];
			ans.push_back(i);
		}
		if (sum < l || sum > u) ans.clear();
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 1 ms 384 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 1 ms 384 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 1 ms 384 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 1 ms 384 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 1 ms 384 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -