Submission #1280768

#TimeUsernameProblemLanguageResultExecution timeMemory
1280768blackscreen1Detecting Molecules (IOI16_molecules)C++20
Compilation error
0 ms0 KiB
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define ld long double
#define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1))
#define iloop_(m, h, g) for (auto i = m; i < h; i += g)
#define jloop_(m, h, g) for (auto j = m; j < h; j += g)
#define kloop_(m, h, g) for (auto k = m; k < h; k += g)
#define lloop_(m, h, g) for (auto l = m; l < h; l += g)
#define getchar_unlocked _getchar_nolock // comment before submission
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define pllll pair<pll, pll>
#define vll vector<ll>
#define qll queue<ll>
#define dll deque<ll>
#define pqll priority_queue<ll>
#define gll greater<ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
int[] find_subset(int l, int u, int[] w) {
  // untested lol
	int n = sizeof(w)/sizeof(w[0]);
	pll a[n];
	iloop(0, n) a[i] = {w[i], i};
	sort(a, a+n);
	ll fs = 0, bs = 0;
	iloop(1, n) {
		fs += a[i-1].first, bs += a[n-i].first;
		if (fs <= l && bs >= u) {
			int res[i], si = 0;
			while (fs < l) {
				fs += a[i + si].first - a[si].first;
				si++;
			}
			jloop(0, i) res[j] = a[si + j].second;
			return res;
		}
	}
	return {};
}

Compilation message (stderr)

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