제출 #397133

#제출 시각아이디문제언어결과실행 시간메모리
397133ak2006Detecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vvi vector<vi> int [] find_subset(int l,int u,int [] w) { int n = sizeof(w)/sizeof(w[0]); vvi a(n,vi(2)); for (int i = 0;i<n;i++)a[i][0] = w[i],a[i][1] = i; ll sum = a[0][0],l = 0,r = 1; while (r <= n){ if (sum >= mn && sum <= mx)break; if (sum > mx){sum -= a[l][0];l++;} else {if (r == n)break;sum += a[r][0];r++;} if (sum >= mn && sum <= mx)break; } if (!(sum >= mn && sum <= mx))return []; int ret[r - l]; for (int i = l;i<r;i++)ret[i - l] = a[i][1]; }

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

molecules.cpp:6:5: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
    6 | int [] find_subset(int l,int u,int [] w)
      |     ^
molecules.cpp:6:5: error: structured binding declaration cannot have type 'int'
    6 | int [] find_subset(int l,int u,int [] w)
      |     ^~
molecules.cpp:6:5: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
molecules.cpp:6:5: error: empty structured binding declaration
molecules.cpp:6:8: error: expected initializer before 'find_subset'
    6 | int [] find_subset(int l,int u,int [] w)
      |        ^~~~~~~~~~~