제출 #773362

#제출 시각아이디문제언어결과실행 시간메모리
773362MatblubeDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
int find_subset(int l, int u, int w[], int n, int result[]){ sort(w, w+n); int a, b, cc=0, pos=0; a=b=0; while(1){ if(b>=n || a>=n) break; if(cc<l){ cc+=w[a++]; continue; } else if(cc>u){ cc-=w[b++]; continue; } for(int i=a ; i<b ; i++){ result[pos++]=w[i]; } return a-b; } return 0; }

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

molecules.cpp: In function 'int find_subset(int, int, int*, int, int*)':
molecules.cpp:2:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    2 |     sort(w, w+n);
      |     ^~~~
      |     short