제출 #1058597

#제출 시각아이디문제언어결과실행 시간메모리
1058597qwusha사탕 분배 (IOI21_candies)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second typedef long double ld; const ld eps = 1e-8; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const ll inf = 1e18; const ll mod = 1e9 + 7; #include "candies.h" int[] distribute_candies(int[] c, int[] l, int[] r, int[] v) { int n = c.size(); vector<int> res(n); for (int qw = 0; qw < l.size(); qw++) { for (int i = l[qw]; i <= r[qw]; i++) { if (v[qw] > 0) { res[i] = min(res[i] + v[qw], c[i]); } else { res[i] = max(res[i] - v[qw], 0); } } } return res; }

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

candies.cpp:14:4: error: structured binding declaration cannot have type 'int'
   14 | int[] distribute_candies(int[] c, int[] l, int[] r, int[] v) {
      |    ^~
candies.cpp:14:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
candies.cpp:14:4: error: empty structured binding declaration
candies.cpp:14:7: error: expected initializer before 'distribute_candies'
   14 | int[] distribute_candies(int[] c, int[] l, int[] r, int[] v) {
      |       ^~~~~~~~~~~~~~~~~~