제출 #505140

#제출 시각아이디문제언어결과실행 시간메모리
505140sliviuDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int r, vector<int> v) { int n = v.size(); long long s = 0; vector<int> p(n), ans; iota(p.begin(), p.end(), 0); sort(p.begin(), p.end(), [&](int i, int j) {return v[i] < v[j]; }); for (int i = 0, j = -1; i < n; ++i) { while (j + 1 < n && s < l) s += v[p[++j]]; if (l <= s && s <= r) { for (int k = i; k <= j; ++k) ans.emplace_back(p[k]); return ans; } if (i <= j) s -= v[p[i]]; } }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:17: warning: control reaches end of non-void function [-Wreturn-type]
    9 |  vector<int> p(n), ans;
      |                 ^
#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...