Submission #1062084

# Submission time Handle Problem Language Result Execution time Memory
1062084 2024-08-16T18:38:21 Z Hectorungo_18 Detecting Molecules (IOI16_molecules) C++14
10 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

// #define int long long
vector<int> find_subset(int l, int r, vector<int> w){
    int n = w.size();
    vector<pair<int, int>> v(n);
    for(int i = 0; i < n; i++){
        v[i]={w[i], i};
    }
    sort(v.begin(), v.end());

    queue<pair<int, int>> sol;
    int aux = 0;
    for(int i = n-1; i >= 0; i--){
        while(aux+v[i].first > r){
            aux-=sol.front().first;
            sol.pop();
        }
        aux+=v[i].first;
        sol.push(v[i]);
        if(aux >= l) break;
    }
    if(aux < l || aux > r){
        while(sol.size()) sol.pop();
    }

    vector<int> ans;
    while(sol.size()){
        ans.push_back(sol.front().second);
        sol.pop();
    }

    if(ans.size()) reverse(ans.begin(), ans.end());

    return ans;
    
    
    
    
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 12, answer = YES)
2 Correct 0 ms 348 KB OK (n = 12, answer = YES)
3 Correct 0 ms 348 KB OK (n = 12, answer = NO)
4 Correct 0 ms 348 KB OK (n = 12, answer = NO)
5 Correct 0 ms 348 KB OK (n = 12, answer = YES)
6 Correct 0 ms 348 KB OK (n = 12, answer = YES)
7 Correct 0 ms 344 KB OK (n = 12, answer = YES)
8 Correct 0 ms 348 KB OK (n = 12, answer = YES)
9 Correct 0 ms 348 KB OK (n = 6, answer = YES)
10 Correct 1 ms 344 KB OK (n = 12, answer = YES)
11 Correct 0 ms 348 KB OK (n = 100, answer = NO)
12 Correct 0 ms 348 KB OK (n = 100, answer = YES)
13 Correct 0 ms 348 KB OK (n = 100, answer = NO)
14 Correct 0 ms 348 KB OK (n = 100, answer = YES)
15 Correct 0 ms 348 KB OK (n = 100, answer = YES)
16 Correct 0 ms 348 KB OK (n = 100, answer = YES)
17 Correct 0 ms 348 KB OK (n = 100, answer = YES)
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -