Submission #1139805

#TimeUsernameProblemLanguageResultExecution timeMemory
1139805SmuggingSpunBubble Sort 2 (JOI18_bubblesort2)C++20
17 / 100
9091 ms580 KiB
#include "bubblesort2.h" #include<bits/stdc++.h> using namespace std; vector<int>countScans(vector<int>a, vector<int>x, vector<int>v){ int n = a.size(), q = x.size(); if(n <= 2000 && q <= 2000){ vector<int>ans(q, 0); for(int _i = 0; _i < q; _i++){ a[x[_i]] = v[_i]; vector<int>A = a; while(true){ bool swapped = false; for(int i = 1; i < n; i++){ if(A[i - 1] > A[i]){ swap(A[i - 1], A[i]); swapped = true; } } if(!swapped){ break; } ans[_i]++; } } return ans; } }

Compilation message (stderr)

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...