# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1135916 | jerzyk | Detecting Molecules (IOI16_molecules) | C++20 | 43 ms | 3656 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1000'000'000'000'000'000LL;
const int II = 2'000'000'000;
const ll M = 1000'000'007LL;
const int N = 1000'007;
pair<int, int> tab[N];
vector<int> find_subset(int _l, int _u, vector<int> _w)
{
vector<int> answer; answer.clear();
int n = (int)_w.size(), l = _l, r = _u;
for(int i = 1; i <= n; ++i)
tab[i] = make_pair(_w[i - 1], i - 1);
sort(tab + 1, tab + 1 + n);
ll s = 0LL; int m = 0;
while(m < n && s + (ll)tab[m + 1].st <= (ll)r)
{
++m;
s += (ll)tab[m].st;
}
if(m == 0) return answer;
int j = 0;
while(j < n - m && s < (ll)l)
{
++j;
s += (ll)(tab[m + j].st - tab[j].st);
}
if(s < (ll)l || s > (ll)r)
return answer;
answer.clear();
for(int i = j + 1; i <= m + j; ++i)
answer.pb(tab[i].nd);
return answer;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |