Submission #14660

# Submission time Handle Problem Language Result Execution time Memory
14660 2015-05-25T08:15:04 Z club4208 배열 탈출 (GA8_array) C++
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
#define MN 20001
#define INF 999999999
using namespace std;
int N; int dt[MN][MN];
int dyn[MN][MN];
int min(int a,int b){
    return (a>b)?b:a;
}
int main(){
    scanf("%d", &N);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            scanf("%d", &dt[i][j]);
            dyn[i][j]=INF;
        }
    }
    dyn[0][0]=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i>0){
                if(dt[i][j]<dt[i-1][j]) dyn[i][j]=min(dyn[i][j], dyn[i-1][j]);
                else dyn[i][j]=min(dyn[i][j],dyn[i-1][j]+(dt[i][j]-dt[i-1][j]+1));
            }
            if(j>0){
                if(dt[i][j]<dt[i][j-1]) dyn[i][j]=min(dyn[i][j], dyn[i][j-1]);
                else dyn[i][j]=min(dyn[i][j],dyn[i][j-1]+(dt[i][j]-dt[i-1][j]+1));
            }
        }
    }
    printf("%d", dyn[N-1][N-1]);
    return 0;
}

Compilation message

array.cpp: In function ‘int main()’:
array.cpp:14:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
                    ^
array.cpp:17:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &dt[i][j]);
                                   ^
/tmp/ccjVkuUg.o: In function `main':
array.cpp:(.text.startup+0x23): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccjVkuUg.o
array.cpp:(.text.startup+0x51): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccjVkuUg.o
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(libc_fatal.o): In function `__libc_message.constprop.0':
(.text+0x13b): relocation truncated to fit: R_X86_64_PC32 against symbol `__abort_msg' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(abort.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(libc_fatal.o): In function `__libc_message':
(.text+0x421): relocation truncated to fit: R_X86_64_PC32 against symbol `__abort_msg' defined in .bss section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(abort.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_get_modules_db':
(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `__gconv_modules_db' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_get_alias_db':
(.text+0x63): relocation truncated to fit: R_X86_64_PC32 against symbol `__gconv_alias_db' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `find_derivation':
(.text+0x31f): relocation truncated to fit: R_X86_64_PC32 against symbol `__gconv_modules_db' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_compare_alias':
(.text+0xc26): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_compare_alias':
(.text+0xc38): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_find_transform':
(.text+0xc90): relocation truncated to fit: R_X86_64_PC32 against symbol `__libc_multiple_threads' defined in COMMON section in /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(libc_multiple_threads.o)
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(gconv_db.o): In function `__gconv_find_transform':
(.text+0xc9b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status