제출 #1132200

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

#include "molecules.h"

using namespace std;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    vector<pair<int,int>> V;
    int n = w.size();
    for(int i = 0; i < n; i++) {
        V.push_back({w[i], i});
    }
    sort(V.begin(), V.end());
    int i = 0, j = 0;
    int x = 0;
    while(i < n && j < n) {
        if(x >= l && x <= u) {
            break;
        }
        if(x < l && j < n - 1) {
            if(j + 1 == n) {
                break;
            }
            x += V[j++].first;
        }
        else {
            x -= V[i++].first;
        }
    }
    vector<int> ans;
    if(x >= l && x <= u) {
        for(int q = i; q <= j; q++) {
            ans.push_back(V[q].second);
        }
    }
    sort(ans.begin(), ans.end());
    return ans;
}

컴파일 시 표준 에러 (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...