답안 #54499

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54499 2018-07-03T18:22:55 Z MoNsTeR_CuBe Detecting Molecules (IOI16_molecules) C++17
0 / 100
3 ms 460 KB
#include "molecules.h"
#include <bits/stdc++.h>
//#define int long long

using namespace std;

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] = make_pair(w[i],i);
    }
    sort(v.begin(), v.end());
    vector<bool> taken(n, false);
    int left = 0, right = 0;
    int tot = 0;
    while(1){
        while(right < n && tot < l){
            tot+=v[right].first;
            taken[v[right].first] = true;
            right++;
        }
        while(left < n && tot > r){
            tot-=v[left].first;
            taken[v[left].first] = false;
            left++;
        }
        if(tot >= l && tot <= r){
            vector<int> ans(0);
            for(int i = 0; i < n; i++){
                if(taken[i]) ans.push_back(i);
            }
            return ans;
        }
        if(left >= n || right >= n) break;
    }
    vector<int> ans(0);
    return ans;
}
/*
signed main(){
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v(0);
    for(int i = 0; i < a; i++){
        int d;
        cin >> d;
        v.push_back(d);
    }
    v = find_subset(b,c,v);
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        cout << v[i] << ' ';
    }
    cout << endl;
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB OK (n = 1, answer = NO)
2 Correct 2 ms 356 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 408 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 460 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB OK (n = 1, answer = NO)
2 Correct 2 ms 356 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 408 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB OK (n = 1, answer = NO)
2 Correct 2 ms 356 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 408 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB OK (n = 1, answer = NO)
2 Correct 2 ms 356 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 408 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB OK (n = 1, answer = NO)
2 Correct 2 ms 356 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 408 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -