Submission #71711

# Submission time Handle Problem Language Result Execution time Memory
71711 2018-08-25T12:48:00 Z the_general(#2235, dbtlswkdrnss) Cross on the Grid (FXCUP3_cross) C++
Compilation error
0 ms 0 KB
#include<stdio.h>
#define MOD 1000000007

int a(int);
int b(int);
int c(int);
int d(int);
int n;
int A[1000000000];
int B[1000000000];
int C[1000000000];
int D[1000000000];

int a(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return (((C[x-2]+D[x-3]-B[x-3])%MOD+B[x-2])%MOD+D[x-3])%MOD;
}

int b(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return (((C[x-2]+D[x-3]-A[x-3])%MOD+A[x-2])%MOD+D[x-3])%MOD;
}

int c(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return ((A[x-2]+B[x-2])%MOD+D[x-3])%MOD;
}

int d(int x){
	if(x==1 || x==2){
		D[x]=1;
		return 1;
	}
	A[x]=a(x);
	B[x]=b(x);
	C[x]=c(x);
	D[x]=(((A[x]+B[x])%MOD+C[x])%MOD+D[x-1])%MOD;
	return D[x];
}

int main(){
	scanf("%d", &n);
	for(int i=1;i<=n;i++){
		d(i);
	}
	printf("%d", D[n]);
}

Compilation message

cross.cpp: In function 'int main()':
cross.cpp:45:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `__environ' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(environ.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x83): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_phdr' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_phdr' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0xd5): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_phnum' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x13e): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_osversion' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_osversion' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `__environ' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(environ.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against symbol `__environ' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(environ.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `generic_start_main':
(.text+0x232): relocation truncated to fit: R_X86_64_PC32 against symbol `__environ' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(environ.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `get_common_indeces.constprop.1':
(.text+0x2b0): relocation truncated to fit: R_X86_64_PC32 against symbol `_dl_x86_cpu_features' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(dl-support.o)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.a(libc-start.o): In function `get_common_indeces.constprop.1':
(.text+0x2b8): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status