Submission #942493

# Submission time Handle Problem Language Result Execution time Memory
942493 2024-03-10T18:06:17 Z attky Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 

using namespace std;

int[] find_subset(int l, int u, int[] w) {
	int n = sizeof(w) / sizeof(int);
	sort(w, w + n);
	for(int loop = 1; loop <= n; ++loop) {
		if(l <= w[0]*loop && w[0]*loop <= u) {
			int tab[loop];
			for(int looping = 0; looping < loop; ++looping) {
				tab[looping] = w[0];
			}
			return tab;
		}
	}
	int tab[0];
	return tab;
}

Compilation message

molecules.cpp:5:4: error: structured binding declaration cannot have type 'int'
    5 | int[] find_subset(int l, int u, int[] w) {
      |    ^~
molecules.cpp:5:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
molecules.cpp:5:4: error: empty structured binding declaration
molecules.cpp:5:7: error: expected initializer before 'find_subset'
    5 | int[] find_subset(int l, int u, int[] w) {
      |       ^~~~~~~~~~~