# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
232612 | 2020-05-17T16:21:58 Z | UserIsUndefined | Detecting Molecules (IOI16_molecules) | C++14 | 6 ms | 384 KB |
#include <bits/stdc++.h> //#include "molecules.h" using namespace std; long long presum[200005]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); vector<pair<int,int>> v; for (int i = 0 ; i < n ; i++){ v.push_back({w[i], i}); } sort(v.begin(), v.end()); for (int i = 0 ; i < n ; i++){ if (i == 0)presum[i] = v[i].first; else presum[i] = presum[i-1] + v[i].first; } vector<int> ans; for (int i = 1 ; i <= n ; i++){ if (presum[i-1] > u)return ans; if (presum[n-1] - presum[n-1-i] < l)continue; long long sum = 0; for (int j = 0 ; j < i ; j++){ sum+= v[j].first; } int x = 0; int y = i; while(y < n){ if ((sum >= l)&&(sum <= u))break; else if (sum < l){ sum+= v[y].first; y++; } else if (sum > u){ sum-= v[x].first; x++; } } for (int j = x ; j < y ; j++){ ans.push_back(v[j].second); } return ans; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 5 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 5 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 5 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 5 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 5 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
13 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 6 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 4 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 4 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 5 ms | 384 KB | OK (n = 100, answer = YES) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | OK (n = 12, answer = YES) |
2 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
3 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 5 ms | 384 KB | OK (n = 12, answer = NO) |
5 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
6 | Incorrect | 5 ms | 384 KB | sum of weights should be in [306..310] but it is 356 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 5 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 5 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 5 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 5 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 5 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
13 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 6 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 4 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 4 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 5 ms | 384 KB | OK (n = 100, answer = YES) |
20 | Correct | 5 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 5 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 5 ms | 384 KB | sum of weights should be in [306..310] but it is 356 |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 5 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 5 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 5 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 5 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 5 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
13 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 6 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 4 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 4 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 5 ms | 384 KB | OK (n = 100, answer = YES) |
20 | Correct | 5 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 5 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 5 ms | 384 KB | sum of weights should be in [306..310] but it is 356 |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 5 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 5 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 5 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 5 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 5 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
13 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 6 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 4 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 4 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 5 ms | 384 KB | OK (n = 100, answer = YES) |
20 | Correct | 5 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 5 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 5 ms | 384 KB | sum of weights should be in [306..310] but it is 356 |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 5 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 5 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 5 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 5 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 5 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 5 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 4 ms | 256 KB | OK (n = 3, answer = YES) |
13 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 6 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 4 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 5 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 4 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 5 ms | 384 KB | OK (n = 100, answer = YES) |
20 | Correct | 5 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 5 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 5 ms | 384 KB | sum of weights should be in [306..310] but it is 356 |
26 | Halted | 0 ms | 0 KB | - |