Submission #676987

#TimeUsernameProblemLanguageResultExecution timeMemory
676987DulguunDetecting Molecules (IOI16_molecules)C++11
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int[] find_subset(int l, int u, int[] w){ int n = sizeof(w)/sizeof(w[0]); vector<pair<int,int>> v(n); for(int i=0; i<n; i++) v[i]={w[i], i}; sort(v.begin(), v.end()); for(int k=n; k>0; k++){ int s=0; for(int i=0; i<k; i++) s+=v[i]; do{ if(s>=l && s<=u) { int sol[k]; for(int j=0; j<k; j++) sol[j]=v[j].second; return sol; }s=s+v[i]-v[i-k]; } while(int i=k; i<n; i++) } }

Compilation message (stderr)

molecules.cpp:4:4: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
    4 | int[] find_subset(int l, int u, int[] w){
      |    ^
molecules.cpp:4:4: error: structured binding declaration cannot have type 'int'
    4 | int[] find_subset(int l, int u, int[] w){
      |    ^~
molecules.cpp:4:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
molecules.cpp:4:4: error: empty structured binding declaration
molecules.cpp:4:7: error: expected initializer before 'find_subset'
    4 | int[] find_subset(int l, int u, int[] w){
      |       ^~~~~~~~~~~