제출 #408758

#제출 시각아이디문제언어결과실행 시간메모리
408758gg123_peBubble Sort 2 (JOI18_bubblesort2)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
#define f(i,a,b) for(ll i=a ; i<b ; i++)

//A
ll n, q, l, x, vi; 
ll a[2005]; 
vector <int> v; 
int solve(){
    v.clear(); 
    ll mini = 1e9+5, ans = 0;  
    f(i,0,n)
        mini = min(mini,a[i]);
    f(i,0,n){
        if(a[i] == mini)
            v.push_back(i); 
    }
    l = v.size();
    f(i,0,l)
        ans = max(ans,abs(v[i]-i));
    return ans;   
}
int main(){
    cin >> n >> q;
    f(i,0,n) cin >> a[i];  
    while(q--){
        cin >> x >> vi;
        a[x] = vi; 
        cout << solve() << '\n';  
    }
    return 0; 
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cc7yAJsn.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAsaZGm.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc7yAJsn.o: in function `main':
grader.cpp:(.text.startup+0x19f): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status