제출 #1300177

#제출 시각아이디문제언어결과실행 시간메모리
1300177orgiloogii곤돌라 (IOI14_gondola)C++20
컴파일 에러
0 ms0 KiB
//#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int inputSeq[]) {
	vector <int> a(n);
	for (int i = 0;i < n;i++) {
		if (inputSeq[i] > n) {
			a[i] = 0;
		}
		else {
			a[i] = inputSeq[i];
		}
	}
	
	bool pos = false;
	int idx = 0;
	for (int i = 0;i < n;i++) {
		if (a[i] != 0 && pos == false) {
			pos = true;
			idx = i;
		}
	}
	int idy = idx + 1;
	if (pos == false) {
		return 1;
	}
	idy %= n;
	while (idy != idx) {
		if (idy == 0) {
			if (a[idy] != 0 && a[idy] != (a[n - 1] % n + 1)) {
				pos = false;
				break;
			}
			else if (a[idy] == 0) {
				a[idy] = a[n - 1] % n + 1;
			}
		}
		else {
			if (a[idy] != 0 && a[idy] != (a[idy - 1] % n + 1)) {
				pos = false;
				break;
			}
			else if (a[idy] == 0) {
				a[idy] = a[idy - 1] % n + 1;
			}
//			cout << 'a';
		}
		idy++;
		idy %= n;
	}
	
	return pos;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
	return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[]) {
  return -3;
}
int main() {
	int arr[5] = {6, 7, 8, 9, 1};
	cout << valid(5, arr) << endl;
}

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

/usr/bin/ld: /tmp/cctAENB6.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8lP905.o:gondola.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cctAENB6.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0xfc): undefined reference to `replacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x18d): undefined reference to `countReplacement'
collect2: error: ld returned 1 exit status