Submission #1136942

#TimeUsernameProblemLanguageResultExecution timeMemory
1136942the_coding_poohDetecting Molecules (IOI16_molecules)C++20
100 / 100
51 ms4132 KiB
#include "molecules.h"

#include <bits/stdc++.h>
#define uwu return

using namespace std;

#define fs first
#define sc second

vector<int> find_subset(int L, int U, vector<int> w) {
	vector <pair<int, int>> w_;
	int N = w.size();
	for(int i = 0; i < N; i++){
		w_.push_back({w[i], i});
	}
	sort(w_.begin(), w_.end());
	long long ttl = 0;
	for(int l = 0, r = -1; l < N; l++){
		while(ttl < L && r < N - 1){
			ttl += w_[++r].fs;
		}
		if(L <= ttl && ttl <= U){
			vector <int> ret;
			for(int i = l; i <= r; i++){
				ret.push_back(w_[i].sc);
			}
			uwu ret;
		}
		ttl -= w_[l].fs;
	}
	uwu {};
}

Compilation message (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...