답안 #304739

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
304739 2020-09-21T19:58:28 Z Gilgamesh Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 256 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);
    }
    return ans;
}
# 결과 실행 시간 메모리 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 Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 256 KB OK (n = 12, answer = NO)
4 Correct 1 ms 256 KB OK (n = 12, answer = NO)
5 Incorrect 1 ms 256 KB sum of weights should be in [290..300] but it is 301
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -