답안 #1084123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084123 2024-09-05T09:00:36 Z Ibrohim0704 Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,k;
    vector<int> a(k);
    for(int i=0;i<k;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=1;i<n;i++){
        ans=max(ans,a[i]-a[i-1]);
    }
    cout<<ans;
}

Compilation message

gap.cpp: In function 'int main()':
gap.cpp:6:20: warning: 'k' is used uninitialized in this function [-Wuninitialized]
    6 |     vector<int> a(k);
      |                    ^
gap.cpp:5:9: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
    5 |     int n,k;
      |         ^
/usr/bin/ld: /tmp/ccu6k3LK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccVSZdrL.o:gap.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccu6k3LK.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status