Submission #1186795

#TimeUsernameProblemLanguageResultExecution timeMemory
1186795AgageldiDetecting Molecules (IOI16_molecules)C++20
46 / 100
1095 ms1028 KiB
#include "bits/stdc++.h"
#include "molecules.h"
// #include "grader.cpp"
using namespace std;

#define N 50000005
#define ll long long

ll n, vis[N];
vector <int> ans;

vector<int> find_subset(int l, int u, vector<int> w) {
	n = (int)w.size();
	ans.clear();
	vis[0] = 1;
	ll sum = 0;
	for(ll j = 0; j < n; j++) {
		for(ll i = u; i >= 0; i--) {
			if(i + w[j] <= u && vis[i] > 0) {
				if(vis[i + w[j]]) continue;
				vis[i + w[j]] = j + 1;
				if(i + w[j] <= u && i + w[j] >= l) {
					i += w[j];
					while(i > 0) {
						ll x = (vis[i]);
						ans.push_back(x - 1);
						i -= w[x - 1];
					}
					return ans;
				}
			}
		}
	}
	return ans;
}

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...