Submission #1120956

#TimeUsernameProblemLanguageResultExecution timeMemory
1120956ntdaccodeBubble Sort 2 (JOI18_bubblesort2)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define fori(i,a,b) for(int i=a;i<=b;i++) #define int long long #define pb push_back using namespace std; typedef pair<int,int> ii; typedef tuple<int,int,int> tp; const int M = 1e6 + 10; const int N = 1e3 + 10; const int mod = 1e9 + 7; int n, q, a[M], bit[M]; void upd(int idx) { while(idx <= n) { bit[idx]++; idx += idx&(-idx); } } int get(int idx) { int res = 0; while(idx > 0) { res += bit[idx]; idx -= idx&(-idx); } return res; } vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) { n = A.size(); q = X.size(); vector<int> ans; for(int i = 1;i <= n; i++) a[i] = A[i - 1]; for(int i = 1;i <= q; i++) { int u,v; u = X[i - 1];v = V[i - 1]; a[u] = v; for(int i = 1;i <= n; i++) bit[i] = 0; int kq = 0; for(int i = n;i != 0; i--) { kq = max(kq,get(a[i])); upd(a[i]); } ans.pb(kq); } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHhYQ6E.o: in function `main':
grader.cpp:(.text.startup+0x181): 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