제출 #818936

#제출 시각아이디문제언어결과실행 시간메모리
818936GangstaDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
/* ID: didarco1 LANG: C++17 TASK: */ // a >> b = a / pow(2,b) // a << b = a * pow(2,b) #include <bits/stdc++.h> #define ll long long int #define pb push_back #define sz size() #define ss second #define ff first #define N 200001 #define pii pair<int,int> using namespace std; //ll _, x, n; int[] find_subset(int l, int u, int w[]) int x = w[0], uly = 0, kici = 0, den = 0, sum = 0, n = sizeof(w); for(int i = 1; i < n; i++){ if(w[i] == x + 1) uly++; else if(w[i] == x - 1) kici++; else if(w[i] == x) den++; } if(den + 1 == n){ for(int i = 0; i < n; i++){ sum += w[i]; result[i] = w[i]; if(sum >= l and sum <= u) return result; } for(int i = 0; i < n; i++) result[i] = 0; return result; } return result; }

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

molecules.cpp:21:4: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 | int[] find_subset(int l, int u, int w[])
      |    ^
molecules.cpp:21:4: error: structured binding declaration cannot have type 'int'
   21 | int[] find_subset(int l, int u, int w[])
      |    ^~
molecules.cpp:21:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
molecules.cpp:21:4: error: empty structured binding declaration
molecules.cpp:21:7: error: expected initializer before 'find_subset'
   21 | int[] find_subset(int l, int u, int w[])
      |       ^~~~~~~~~~~
molecules.cpp:23:2: error: expected unqualified-id before 'for'
   23 |  for(int i = 1; i < n; i++){
      |  ^~~
molecules.cpp:23:17: error: 'i' does not name a type
   23 |  for(int i = 1; i < n; i++){
      |                 ^
molecules.cpp:23:24: error: 'i' does not name a type
   23 |  for(int i = 1; i < n; i++){
      |                        ^
molecules.cpp:28:2: error: expected unqualified-id before 'if'
   28 |  if(den + 1 == n){
      |  ^~
molecules.cpp:37:2: error: expected unqualified-id before 'return'
   37 |  return result;
      |  ^~~~~~
molecules.cpp:38:1: error: expected declaration before '}' token
   38 | }
      | ^