답안 #408759

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
408759 2021-05-19T15:24:22 Z gg123_pe Bubble Sort 2 (JOI18_bubblesort2) C++14
컴파일 오류
0 ms 0 KB
#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 <ll> 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; 
}

Compilation message

/usr/bin/ld: /tmp/ccSPcthQ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccNs1bhQ.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccSPcthQ.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