Submission #304740

# Submission time Handle Problem Language Result Execution time Memory
304740 2020-09-21T19:59:03 Z Gilgamesh Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 384 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n = w.size();
    vector<int> ans;
    vector<pair<int, int>> mlcs;
    for(int i = 0; i < n; ++i){
        mlcs.emplace_back(make_pair(w[i], i));
    }
    sort(mlcs.begin(), mlcs.end());
    int p1 = 0, p2 = 0;
    long long cursum = 0;
    bool poss = false;
    while(p2 < n){
        cursum += mlcs[p2++].first;
        while(cursum > u){
            cursum -= mlcs[p1++].first;
        }
        if(cursum >= l && cursum <= u){
            poss = true;
            break;
        }
    }
    if(!poss) return ans;
    for(int i = p1; i < p2; ++i){
        ans.emplace_back(mlcs[i].second + 1);
    }
    sort(ans.begin(), ans.end());
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 12, answer = YES)
2 Correct 1 ms 256 KB OK (n = 12, answer = YES)
3 Correct 1 ms 288 KB OK (n = 12, answer = NO)
4 Correct 0 ms 256 KB OK (n = 12, answer = NO)
5 Incorrect 0 ms 256 KB sum of weights should be in [290..300] but it is 301
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -