답안 #125804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125804 2019-07-06T11:47:13 Z Sorting Detecting Molecules (IOI16_molecules) C++14
9 / 100
2 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 7;

long long prefix[N], suffix[N];

long long find_sum(int l, int r){
	if(l == 0){
		return prefix[r];
	}

	return prefix[r] - prefix[l - 1];
}

vector<int> find_subset(int l, int r, vector<int> w){
	vector<int> ans;
	int n = (int)w.size();

	sort(w.begin(), w.end());

	prefix[0] = w[0];
	for(int i = 1; i < n; i++){
		prefix[i] = prefix[i - 1] + (long long)w[i];
	}

	for(int i = 1; i <= n; i++){
		if(find_sum(0, i - 1) > r || find_sum(n - i, n - 1) < l){
			continue;
		}

		for(int j = 0; j <= n - i; j++){
			long long sum = find_sum(j, j + i - 1);

			if(l <= sum && sum <= r){
				for(int k = 0; k < i; k++){
					ans.push_back(j + k);
				}

				return ans;
			}
		}
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 256 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 256 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 380 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 12, answer = YES)
2 Correct 2 ms 376 KB OK (n = 12, answer = YES)
3 Correct 2 ms 256 KB OK (n = 12, answer = NO)
4 Correct 2 ms 376 KB OK (n = 12, answer = NO)
5 Correct 2 ms 376 KB OK (n = 12, answer = YES)
6 Correct 2 ms 376 KB OK (n = 12, answer = YES)
7 Correct 2 ms 256 KB OK (n = 12, answer = YES)
8 Correct 2 ms 256 KB OK (n = 12, answer = YES)
9 Correct 2 ms 376 KB OK (n = 6, answer = YES)
10 Correct 2 ms 376 KB OK (n = 12, answer = YES)
11 Correct 2 ms 376 KB OK (n = 100, answer = NO)
12 Incorrect 2 ms 376 KB sum of weights should be in [50..51] but it is 37
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 256 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 256 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 380 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 376 KB OK (n = 12, answer = YES)
21 Correct 2 ms 376 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 376 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 256 KB OK (n = 12, answer = YES)
27 Correct 2 ms 256 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 376 KB OK (n = 12, answer = YES)
30 Correct 2 ms 376 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 376 KB sum of weights should be in [50..51] but it is 37
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 256 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 256 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 380 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 376 KB OK (n = 12, answer = YES)
21 Correct 2 ms 376 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 376 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 256 KB OK (n = 12, answer = YES)
27 Correct 2 ms 256 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 376 KB OK (n = 12, answer = YES)
30 Correct 2 ms 376 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 376 KB sum of weights should be in [50..51] but it is 37
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 256 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 256 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 380 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 376 KB OK (n = 12, answer = YES)
21 Correct 2 ms 376 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 376 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 256 KB OK (n = 12, answer = YES)
27 Correct 2 ms 256 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 376 KB OK (n = 12, answer = YES)
30 Correct 2 ms 376 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 376 KB sum of weights should be in [50..51] but it is 37
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 376 KB OK (n = 2, answer = YES)
5 Correct 2 ms 256 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 376 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 256 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 380 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 2 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 376 KB OK (n = 12, answer = YES)
21 Correct 2 ms 376 KB OK (n = 12, answer = YES)
22 Correct 2 ms 256 KB OK (n = 12, answer = NO)
23 Correct 2 ms 376 KB OK (n = 12, answer = NO)
24 Correct 2 ms 376 KB OK (n = 12, answer = YES)
25 Correct 2 ms 376 KB OK (n = 12, answer = YES)
26 Correct 2 ms 256 KB OK (n = 12, answer = YES)
27 Correct 2 ms 256 KB OK (n = 12, answer = YES)
28 Correct 2 ms 376 KB OK (n = 6, answer = YES)
29 Correct 2 ms 376 KB OK (n = 12, answer = YES)
30 Correct 2 ms 376 KB OK (n = 100, answer = NO)
31 Incorrect 2 ms 376 KB sum of weights should be in [50..51] but it is 37
32 Halted 0 ms 0 KB -