답안 #102046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102046 2019-03-22T00:37:32 Z tim25871014 Detecting Molecules (IOI16_molecules) C++17
0 / 100
3 ms 512 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l,int u,vector<int> w){

    vector<int> ans;

    int n=w.size();
    vector<pair<int,int>> wp;
    for(int i=0;i<n;i++)
        wp.push_back({w[i],i});
    sort(wp.begin(),wp.end());

    int sum=0,check=0;
    deque<pair<int,int>> sub;
    for(int i=0;i<n;i++){
        sum+=w[i],sub.push_back(wp[i]);
        while(sum>u) sum-=sub.front().second,sub.pop_front();
        if(sum<=u && sum>=l) {check=1;break;}
    }
    if(!check) return ans;
    for(auto i:sub) ans.push_back(i.second+1);
    return ans;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -