Submission #405029

#TimeUsernameProblemLanguageResultExecution timeMemory
405029rainboyDetecting Molecules (IOI16_molecules)C11
0 / 100
1 ms204 KiB
#include "molecules_c.h"

int find_subset(int lower, int upper, int *ww, int n, int *ii) {
	int m, h;
	long long lower_, upper_;

	lower_ = upper_ = 0;
	for (m = 1; m <= n; m++) {
		lower_ += ww[m], upper_ += ww[n - 1 - m];
		if (lower_ <= upper && upper_ >= lower) {
			long long sum;

			sum = 0;
			for (h = 0; h < m; h++)
				ii[h] = h, sum += ww[h];
			for (h = m - 1; h >= 0 && sum < lower; h--)
				ii[h] = n - 1 - (m - 1 - h); sum += ww[ii[h]] - ww[h];
			return m;
		}
	}
	return 0;
}

Compilation message (stderr)

molecules.c: In function 'find_subset':
molecules.c:16:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   16 |    for (h = m - 1; h >= 0 && sum < lower; h--)
      |    ^~~
molecules.c:17:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   17 |     ii[h] = n - 1 - (m - 1 - h); sum += ww[ii[h]] - ww[h];
      |                                  ^~~
#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...