답안 #297916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
297916 2020-09-12T07:05:06 Z Azimjon Detecting Molecules (IOI16_molecules) C++17
10 / 100
1 ms 256 KB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef vector<pair<long long, long long>>  vii;

std::vector<int> find_subset(int l, int r, std::vector<int> w) {
    int n = w.size();
    vii a(n);
    for (int i = 0; i < n; i++)
        a[i] = {w[i], i};
    
    sort(a.begin(), a.end());

    int tl, tr;
    tl = tr = 0;
    int yi = a[0].first;

    while (tr < n - 1) {
        if (l <= yi && yi <= r) {
            vector<int> jv;
            for (int i = tl; i <= tr; i++) {
                jv.push_back(a[i].second);
            }
            return jv;
        }
        tr++;
        yi += a[tr].first;

        while (yi > r && tl < tr) {
            yi -= a[tl].first;
            tl++;
        }
         if (l <= yi && yi <= r) {
            vector<int> jv;
            for (int i = tl; i <= tr; i++) {
                jv.push_back(a[i].second);
            }
            return jv;
        }
    }

    return vector<int>();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 12, answer = YES)
2 Correct 0 ms 256 KB OK (n = 12, answer = YES)
3 Correct 0 ms 256 KB OK (n = 12, answer = NO)
4 Correct 0 ms 256 KB OK (n = 12, answer = NO)
5 Correct 0 ms 256 KB OK (n = 12, answer = YES)
6 Correct 0 ms 256 KB OK (n = 12, answer = YES)
7 Correct 0 ms 256 KB OK (n = 12, answer = YES)
8 Correct 0 ms 256 KB OK (n = 12, answer = YES)
9 Correct 1 ms 256 KB OK (n = 6, answer = YES)
10 Correct 0 ms 256 KB OK (n = 12, answer = YES)
11 Correct 1 ms 256 KB OK (n = 100, answer = NO)
12 Correct 1 ms 256 KB OK (n = 100, answer = YES)
13 Correct 0 ms 256 KB OK (n = 100, answer = NO)
14 Correct 1 ms 256 KB OK (n = 100, answer = YES)
15 Correct 0 ms 256 KB OK (n = 100, answer = YES)
16 Correct 0 ms 256 KB OK (n = 100, answer = YES)
17 Correct 1 ms 256 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -