Submission #317275

# Submission time Handle Problem Language Result Execution time Memory
317275 2020-10-29T09:09:57 Z analyticalprogrammer Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;


int[] find_subset(int l, int u, int[] w){
  int n = 0;
  for(int&k:w) n++;
  int start = 0;
  for(int end =0 ;end<n;end++){
    queue<int> subset;
    int cursum = 0;
    for(int i =start;i<end-start+1;i++){
      cursum+=w[i];
      subset.push(w[i]);

    }
    if(cursum>=l &&<=u){
      break;
    }
    else if(cursum>u){
      subset.pop();
      start++;
    }
  }
  int index= 0 ;
  int result[n];
  for(auto i =subset.front(); i != subset.back(); i++)
    {
      result[index] = i;
            index++;
    }
    return result;
}

Compilation message

molecules.cpp:5:4: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
    5 | int[] find_subset(int l, int u, int[] w){
      |    ^
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){
      |       ^~~~~~~~~~~