제출 #1260849

#제출 시각아이디문제언어결과실행 시간메모리
1260849antonnDetecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms324 KiB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<int> find_subset(int l, int u, vector<int> w) {
    int n = w.size();
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int x, int y) {
        return w[x] < w[y];
    });
    int j = 0;
    for (int i = 0; i < n; ++i) {
        ll s = 0;
        while (j < n && s < l) {
            s += w[ord[j]];
            ++j;
        }
        if (l <= s && s <= u) {
            vector<int> res;
            for (int k = i; k <= j; ++k) res.push_back(ord[k]);
            return res;
        }
        s -= w[ord[i]];
    }
    return {};
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...