Submission #38714

# Submission time Handle Problem Language Result Execution time Memory
38714 2018-01-06T10:07:09 Z 14kg Gondola (IOI14_gondola) C++11
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <assert.h>
#include "gondola.h"

int gondolaSequence[100001];
int replacementSequence[250001];

int main()
{
	freopen("sample-2.in", "r", stdin);

	int i, n, tag;
	int nr;
	assert(scanf("%d", &tag) == 1);
	assert(scanf("%d", &n) == 1);
	for (i = 0; i < n; i++)
		assert(scanf("%d", &gondolaSequence[i]) == 1);

	switch (tag) {
	case 1: case 2: case 3:
		printf("%d\n", valid(n, gondolaSequence));
		break;

	case 4: case 5: case 6:
		nr = replacement(n, gondolaSequence, replacementSequence);
		printf("%d ", nr);
		if (nr > 0)
		{
			for (i = 0; i < nr - 1; i++)
				printf("%d ", replacementSequence[i]);
			printf("%d\n", replacementSequence[nr - 1]);
		}
		else printf("\n");
		break;

	case 7: case 8: case 9: case 10:
		printf("%d\n", countReplacement(n, gondolaSequence));
		break;
	}

	return 0;
}

Compilation message

gondola.cpp: In function 'int main()':
gondola.cpp:10:36: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("sample-2.in", "r", stdin);
                                    ^
/tmp/ccA3w53I.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cch3nsd7.o:gondola.cpp:(.text.startup+0x0): first defined here
/tmp/ccA3w53I.o:(.bss+0xf4260): multiple definition of `gondolaSequence'
/tmp/cch3nsd7.o:(.bss+0xf4260): first defined here
/tmp/ccA3w53I.o:(.bss+0x0): multiple definition of `replacementSequence'
/tmp/cch3nsd7.o:(.bss+0x0): first defined here
/tmp/cch3nsd7.o: In function `main':
gondola.cpp:(.text.startup+0xdb): undefined reference to `countReplacement'
gondola.cpp:(.text.startup+0xfa): undefined reference to `valid'
gondola.cpp:(.text.startup+0x10b): undefined reference to `replacement'
/tmp/ccA3w53I.o: In function `main':
grader.cpp:(.text.startup+0xcb): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0xea): undefined reference to `valid'
grader.cpp:(.text.startup+0x10e): undefined reference to `replacement'
collect2: error: ld returned 1 exit status