제출 #283520

#제출 시각아이디문제언어결과실행 시간메모리
283520FlashGamezzz선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include "boxes.h" using namespace std; long teams[10000000]; long long delivery(int N, int K, int L, int p[]) { long n = N, k = K, len = L; long long ans = 1000000000000000000; for (long i = 0; i < n; i++){ teams[i] = p[i]; } for (long i = 0; i < k && i < n; i++){ long long t = min(len, min(2*teams[i], 2*(len-teams[0]))); long l = i+1, r = i+k-1; while (true){ if (r >= n){ if (l < n){ r = n-1; t += min(len, min(2*teams[r], 2*(len-left[l]))); } break; } t += min(len, min(2*teams[r], 2*(len-teams[l]))); l += K; r += K; } ans = min(ans, t); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:27:49: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |      t += min(len, min(2*teams[r], 2*(len-left[l])));
      |                                                 ^
boxes.cpp:27:42: error: invalid operands of types 'long int' and 'std::ios_base&(std::ios_base&)' to binary 'operator-'
   27 |      t += min(len, min(2*teams[r], 2*(len-left[l])));
      |                                       ~~~^~~~~~~~
      |                                       |         |
      |                                       long int  std::ios_base&(std::ios_base&)