제출 #1087182

#제출 시각아이디문제언어결과실행 시간메모리
1087182MahmytMDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#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; } }

컴파일 시 표준 에러 (stderr) 메시지

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;
      |          ^~~~~~