제출 #1266604

#제출 시각아이디문제언어결과실행 시간메모리
1266604thewizardmanDetecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms328 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; ll n, mn, mx; vector<pll> v; vector<int> ans; std::vector<int> find_subset(int l, int u, std::vector<int> w) { n = w.size(); v.resize(n); for (int i = 0; i < n; i++) v[i] = {w[i], i}; sort(v.begin(), v.end()); for (int i = 0; i < n; i++) { mn += v[i].first; mx += v[n-i-1].first; if (mn <= u && mx >= l) { for (int j = 0; j <= i; j++) ans.push_back(i); while (mn < l) { auto it = prev(lower_bound(ans.begin(), ans.end(), n-1)); mn -= v[*it].first; (*it)++; mn += v[*it].first; } break; } } for (auto &e: ans) e = v[e].second; 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...