제출 #1359931

#제출 시각아이디문제언어결과실행 시간메모리
1359931NAMIN선물상자 (IOI15_boxes)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "boxes.h"
#define ll long long

using namespace std;

ll delivery(int N, int K, int L, int p[]) {
	ll ans = 0;
	deqeue<int> dq;
	for(int i=0;i<N;i++)
		dq.push_back(p[i]);
	sort(dq.begin(),dq.end());
	while(dq.size()>=K){
		ll costl = min(N,dq[K-1]*2);
		ll costr = min(N,(L-dq[N-K])*2);
		if(costl<=costr){
			ans += costl;
			for(int i=0;i<K;i++)
				dq.pop_front();
		}
		else{
			ans += costr;
			for(int i=0;i<K;i++)
				dq.pop_back();
		}
	}
	if(dq.size()>0)
		ans += min(min(N,dq.back()*2),min(N,(L-dq[0]*2)));
    return ans;
}

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:9:9: error: 'deqeue' was not declared in this scope
    9 |         deqeue<int> dq;
      |         ^~~~~~
boxes.cpp:9:16: error: expected primary-expression before 'int'
    9 |         deqeue<int> dq;
      |                ^~~
boxes.cpp:11:17: error: 'dq' was not declared in this scope
   11 |                 dq.push_back(p[i]);
      |                 ^~
boxes.cpp:12:14: error: 'dq' was not declared in this scope
   12 |         sort(dq.begin(),dq.end());
      |              ^~