답안 #1054416

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1054416 2024-08-12T09:44:03 Z NeroZein Bubble Sort 2 (JOI18_bubblesort2) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
 
#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif
 
int count(vector<int> a) {
  int ret = 0;
  int n = (int) a.size();
  vector<int> ord(n);
  iota(ord.begin(), ord.end(), 0);
  sort(ord.begin(), ord.end(), [&](int i, int j) {
    return (a[i] == a[j] ? i < j : a[i] < a[j]);
  });
  int cnt = 0; 
  for (int i : ord) {
    ret = max(ret, i - cnt);
    cnt++;
  }
  return ret; 
}
 
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
  int q = (int) x.size();
  vector<int> ret(q);
  for (int i = 0; i < q; ++i) {
    a[x[i]] = v[i];
    ret[i] = count(a);
  }
  return ret; 
}
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  vector<int> a(n); 
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> x(q), v(q); 
  for (int i = 0; i < q; ++i) {
    cin >> x[i] >> v[i];
  }
  vector<int> answers = countScans(a, x, v); 
  for (int i : answers) {
    cout << i << '\n';
  }
  return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccNLkDP6.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc5bI6b9.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status