Submission #1087182

# Submission time Handle Problem Language Result Execution time Memory
1087182 2024-09-12T09:14:48 Z MahmytM Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
int find_subset(int l, int u, int[] w, int n, int[] result){
	int sum=0,k=0;
	for(int i=0;i<n;i++){
		if(sum+w[i]<u){
			sum+=w[i];
			k++,result[k]=i;
		}
	}
	if(l<=sum and sum<=u){
		return result;
	}else{
		return 0;	
	}
}

Compilation message

molecules.cpp:9:37: error: expected ',' or '...' before 'w'
    9 | 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:11:16: error: 'n' was not declared in this scope
   11 |  for(int i=0;i<n;i++){
      |                ^
molecules.cpp:12:10: error: 'w' was not declared in this scope
   12 |   if(sum+w[i]<u){
      |          ^
molecules.cpp:14:8: error: 'result' was not declared in this scope
   14 |    k++,result[k]=i;
      |        ^~~~~~
molecules.cpp:18:10: error: 'result' was not declared in this scope
   18 |   return result;
      |          ^~~~~~