제출 #1064330

#제출 시각아이디문제언어결과실행 시간메모리
1064330wood휴가 (IOI14_holiday)C++17
컴파일 에러
0 ms0 KiB
#include"holiday.h" long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll result = 0; for (int i = 0; i <= start; ++i) { for(int j = start; j<n; j++){ vi res; for(int k = i; k<=j;k++){ res.pb(attractions[k]); } sort(res.begin(),res.end(), greater<>()); int left = d-j+i-1; left = min(d,res.size()); ll sum = 0; for(int k = 0; k<left; k++){ sum+=res[k]; } result = max(result,sum); } } return result; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:4:2: error: 'll' was not declared in this scope
    4 |  ll result = 0;
      |  ^~
holiday.cpp:7:4: error: 'vi' was not declared in this scope; did you mean 'i'?
    7 |    vi res;
      |    ^~
      |    i
holiday.cpp:9:5: error: 'res' was not declared in this scope
    9 |     res.pb(attractions[k]);
      |     ^~~
holiday.cpp:9:12: error: 'attractions' was not declared in this scope; did you mean 'attraction'?
    9 |     res.pb(attractions[k]);
      |            ^~~~~~~~~~~
      |            attraction
holiday.cpp:11:9: error: 'res' was not declared in this scope
   11 |    sort(res.begin(),res.end(), greater<>());
      |         ^~~
holiday.cpp:11:32: error: 'greater' was not declared in this scope
   11 |    sort(res.begin(),res.end(), greater<>());
      |                                ^~~~~~~
holiday.cpp:11:40: error: expected primary-expression before '>' token
   11 |    sort(res.begin(),res.end(), greater<>());
      |                                        ^
holiday.cpp:11:42: error: expected primary-expression before ')' token
   11 |    sort(res.begin(),res.end(), greater<>());
      |                                          ^
holiday.cpp:11:4: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |    sort(res.begin(),res.end(), greater<>());
      |    ^~~~
      |    short
holiday.cpp:13:11: error: 'min' was not declared in this scope
   13 |    left = min(d,res.size());
      |           ^~~
holiday.cpp:14:6: error: expected ';' before 'sum'
   14 |    ll sum = 0;
      |      ^~~~
      |      ;
holiday.cpp:16:5: error: 'sum' was not declared in this scope
   16 |     sum+=res[k];
      |     ^~~
holiday.cpp:18:4: error: 'result' was not declared in this scope
   18 |    result = max(result,sum);
      |    ^~~~~~
holiday.cpp:18:24: error: 'sum' was not declared in this scope
   18 |    result = max(result,sum);
      |                        ^~~
holiday.cpp:18:13: error: 'max' was not declared in this scope
   18 |    result = max(result,sum);
      |             ^~~
holiday.cpp:21:9: error: 'result' was not declared in this scope
   21 |  return result;
      |         ^~~~~~