제출 #1267023

#제출 시각아이디문제언어결과실행 시간메모리
1267023zagaroDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms328 KiB
#include<bits/stdc++.h>
#include "molecules.h"
#define wl while
#define tp_set ll
typedef long long ll;
using namespace std;
vector<int> find_subset(int x, int y, vector<int> w) {
    ll l, r, m, n, s, p;
    bool B;
    n = w.size();
    vector<pair<ll,ll> > vec(n+1);
    for(int i=1;i<=n;i++)vec[i] = {w[i-1], i-1};
    sort(vec.begin(), vec.end());
    for(int i=2;i<=n;i++)vec[i].first+=vec[i-1].first;
    p= -1;
    for(int i=1;i<=n;i++){
        B=false;
        l=0;
        r=(n-i)+1;
        wl(l<r-1){
            m = (l+r)/2;
            s = vec[m+i].first-vec[m].first;
            if(s>=x && s <= y){B=true;break;}
            else if(s<x)l=m;
            else r=m;
        }
        if(B){p=i;break;}
        else {
            s = vec[l+i].first-vec[l].first;
            if(s>=x && s <= y){B=true;break;}
        }
    }
    vector<int> res;
    if(B){
        for(int i=1;i<=p;i++)res.push_back(vec[m+i].second);
    }
    return res;
}

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