Submission #317272

# Submission time Handle Problem Language Result Execution time Memory
317272 2020-10-29T09:07:54 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, int[] result){
  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 ;
  for(auto i =subset.front(); i != subset.back(); i++)
    {
      result[index] = i;
            index++;
    }
    return result;
}

Compilation message

molecules.cpp:5:37: error: expected ',' or '...' before 'w'
    5 | int find_subset(int l, int u, int[] w, int n, int[] result){
      |                                     ^
molecules.cpp: In function 'int find_subset(int, int, int*)':
molecules.cpp:7:23: error: 'n' was not declared in this scope
    7 |   for(int end =0 ;end<n;end++){
      |                       ^
molecules.cpp:11:15: error: 'w' was not declared in this scope
   11 |       cursum+=w[i];
      |               ^
molecules.cpp:15:20: error: expected primary-expression before '<=' token
   15 |     if(cursum>=l &&<=u){
      |                    ^~
molecules.cpp:24:15: error: 'subset' was not declared in this scope; did you mean 'sigset'?
   24 |   for(auto i =subset.front(); i != subset.back(); i++)
      |               ^~~~~~
      |               sigset
molecules.cpp:26:7: error: 'result' was not declared in this scope
   26 |       result[index] = i;
      |       ^~~~~~
molecules.cpp:29:12: error: 'result' was not declared in this scope
   29 |     return result;
      |            ^~~~~~