Submission #1314962

#TimeUsernameProblemLanguageResultExecution timeMemory
1314962dgiDancing Elephants (IOI11_elephants)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int n, l;
int x[1000000000];
/*void init(n, l, x){
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		cin >> x[i];
}*/
int main(){
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	int k = n - 2;
	int m = x[n - 1];
	int ans = 0;
	for (int i = x[n - 1]; i--; i >= 0){
		if (i == x[k]) k--;
		if (i == m - l) {
			m -= l;
			while (m != x[k]) m--;
			ans++;
		}
		if (i == x[k]) k--;
	}
	cout << ans << endl;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccFrQGkW.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccjk1Bym.o:elephants.cpp:(.text.startup+0x0): first defined here
/tmp/ccFrQGkW.o: in function `read_input()':
grader.cpp:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x43): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x87): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x99): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0xa0): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0xd9): additional relocation overflows omitted from the output
/usr/bin/ld: /tmp/ccFrQGkW.o: in function `main':
grader.cpp:(.text.startup+0x27): undefined reference to `init(int, int, int*)'
/usr/bin/ld: grader.cpp:(.text.startup+0x56): undefined reference to `update(int, int)'
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1f): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1ed): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x252): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2bc): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x316): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x50f): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x57d): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5f0): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x654): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status