Submission #297912

# Submission time Handle Problem Language Result Execution time Memory
297912 2020-09-12T07:01:46 Z Azimjon Detecting Molecules (IOI16_molecules) C++17
0 / 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++;
        }
    }

    return vector<int>();
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 12, answer = YES)
2 Correct 1 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 1 ms 256 KB OK (n = 12, answer = YES)
6 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -