제출 #1182231

#제출 시각아이디문제언어결과실행 시간메모리
1182231soykLabels (NOI20_labels)C++20
컴파일 에러
0 ms0 KiB
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;
	int *in=(int*)malloc(sizeof(int)*(N-1)), *out = (int*)malloc(sizeof(int) * (N));
	int neg_max=0, pos_max=0, sum=0,possible=0,oneindex=-1,posindex=-1,negindex=-1;
	for (int a = 0; a < N - 1; a++)
	{
		cin >> in[a];
		sum += in[a];
		if (neg_max > sum) {
			neg_max = sum;
			negindex = a;
		}
		if (pos_max < sum) {
			pos_max = sum;
			posindex = a;
		}
		if (pos_max - neg_max > N - 1)
		{
			possible = 0;
			break;
		}
		if (pos_max - neg_max == N - 1)
		{
			oneindex = negindex + 1;
			possible = 1;
		}
	}
	if (possible == 0)
		cout << -1;
	else {
		out[oneindex] = 1;
		for (int a = oneindex - 1; a >= 0; a--)
			out[a] = out[a + 1] - in[a];
		for (int a = oneindex + 1; a < N; a++)
			out[a] = out[a - 1] + in[a - 1];
		for (int a = 0; a < N; a++)
			cout << out[a] << " ";
	}
}

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

Labels.cpp:3:9: fatal error: conio.h: No such file or directory
    3 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.