제출 #1187038

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

vector<int> find_subset(int l, int u, vector<int> w) {
	long long n = w.size();
	vector <pair <long long, long long>> p;
	p.push_back({0, 0});
	for (long long i = 0;i < n;i++) {
		p.push_back({w[i], i});
	}
	sort(p.begin(), p.end());
	vector <int> res;
	int l1 = 1, r = 1;
	long long suml = 0, summer = 0;
	long long sum = 0;
	while (r <= n && l1 <= n) {
		while (sum < l) {
			sum += p[r].first;
			r++;
		}
		while (sum > u) {
			sum -= p[l1].first;
			l1++;
		}
		if (sum <= u && sum >= l) {
			while (l1 < r) {
				res.push_back(p[l1].second);
				l1++;
			}
			return res;
		}
	}
	return res;
}

//signed main() {
//}

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