Submission #548088

#TimeUsernameProblemLanguageResultExecution timeMemory
548088blueBubble Sort 2 (JOI18_bubblesort2)C++17
Compilation error
0 ms0 KiB
#include "bubblesort2.h" #include <vector> #include <set> #include <map> #include <iostream> #include <algorithm> using namespace std; using vi = vector<int>; using pii = pair<int, int>; #define sz(x) int(x.size()) vi countScans(vi A, vi X, vi V) { N = sz(A); Q = sz(X); vi answer(Q); for(int j = 0; j < Q; j++) { A[X[j]] = V[j]; vector<pii> pos; for(int i = 0; i < N; i++) pos.push_back({A[i], i}); sort(pos.begin(), pos.end()); int res = 0; for(int i = 0; i < N; i++) { if(i > 0 && pos[i].first == pos[i-1].first) continue; res = max(res, pos[i].second - i); } answer[j] = res; } return answer; }

Compilation message (stderr)

bubblesort2.cpp: In function 'vi countScans(vi, vi, vi)':
bubblesort2.cpp:15:2: error: 'N' was not declared in this scope
   15 |  N = sz(A);
      |  ^
bubblesort2.cpp:16:2: error: 'Q' was not declared in this scope
   16 |  Q = sz(X);
      |  ^