답안 #137023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137023 2019-07-26T22:59:19 Z MladenP Detecting Molecules (IOI16_molecules) C++17
9 / 100
22 ms 2412 KB
#include "molecules.h"
#include <bits/stdc++.h>
#define MAXN 200010
#define pb push_back

using namespace std;

struct mol{
    int i, val;
};

bool cmp(mol a, mol b) { return a.val < b.val; }

mol a[MAXN];
vector<int> sol;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n = w.size();

    for(int i = 0; i < n; i++) {
        a[i].val = w[i]; a[i].i = i;
    }
    sort(a, a+n, cmp);
    long long zbir =  a[0].val;
    int L = 0, R = 1;
    while(L < R && (L < n || R < n)) {
        if(zbir < l) {
          zbir += a[R].val;
          R++;
        } else if(zbir > u) {
          zbir -= a[L].val;
          L++;
        } else {
            for(int k = L; k < R; k++) sol.push_back(a[k].i);
            return sol;
        }
    }

    return std::vector<int>(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 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 256 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 256 KB OK (n = 3, answer = YES)
9 Correct 2 ms 380 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 252 KB OK (n = 3, answer = YES)
12 Correct 2 ms 396 KB OK (n = 3, answer = YES)
13 Correct 3 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 3 ms 256 KB OK (n = 3, answer = NO)
18 Correct 3 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 256 KB OK (n = 12, answer = YES)
2 Correct 2 ms 256 KB OK (n = 12, answer = YES)
3 Correct 3 ms 376 KB OK (n = 12, answer = NO)
4 Incorrect 22 ms 2412 KB Integer 200693 violates the range [0, 12]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 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 256 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 256 KB OK (n = 3, answer = YES)
9 Correct 2 ms 380 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 252 KB OK (n = 3, answer = YES)
12 Correct 2 ms 396 KB OK (n = 3, answer = YES)
13 Correct 3 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 3 ms 256 KB OK (n = 3, answer = NO)
18 Correct 3 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 256 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 3 ms 376 KB OK (n = 12, answer = NO)
23 Incorrect 22 ms 2412 KB Integer 200693 violates the range [0, 12]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 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 256 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 256 KB OK (n = 3, answer = YES)
9 Correct 2 ms 380 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 252 KB OK (n = 3, answer = YES)
12 Correct 2 ms 396 KB OK (n = 3, answer = YES)
13 Correct 3 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 3 ms 256 KB OK (n = 3, answer = NO)
18 Correct 3 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 256 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 3 ms 376 KB OK (n = 12, answer = NO)
23 Incorrect 22 ms 2412 KB Integer 200693 violates the range [0, 12]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 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 256 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 256 KB OK (n = 3, answer = YES)
9 Correct 2 ms 380 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 252 KB OK (n = 3, answer = YES)
12 Correct 2 ms 396 KB OK (n = 3, answer = YES)
13 Correct 3 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 3 ms 256 KB OK (n = 3, answer = NO)
18 Correct 3 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 256 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 3 ms 376 KB OK (n = 12, answer = NO)
23 Incorrect 22 ms 2412 KB Integer 200693 violates the range [0, 12]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 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 256 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 256 KB OK (n = 3, answer = YES)
9 Correct 2 ms 380 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 252 KB OK (n = 3, answer = YES)
12 Correct 2 ms 396 KB OK (n = 3, answer = YES)
13 Correct 3 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 256 KB OK (n = 3, answer = YES)
15 Correct 2 ms 376 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 3 ms 256 KB OK (n = 3, answer = NO)
18 Correct 3 ms 376 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Correct 2 ms 256 KB OK (n = 12, answer = YES)
21 Correct 2 ms 256 KB OK (n = 12, answer = YES)
22 Correct 3 ms 376 KB OK (n = 12, answer = NO)
23 Incorrect 22 ms 2412 KB Integer 200693 violates the range [0, 12]
24 Halted 0 ms 0 KB -