Submission #363216

#TimeUsernameProblemLanguageResultExecution timeMemory
363216teewarBubble Sort 2 (JOI18_bubblesort2)C++14
0 / 100
9091 ms816 KiB
#include "bubblesort2.h" #include <vector> using namespace std; vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) { int n = a.size(); int q = x.size(); vector<int> ret(q); for(int t = 0; t < q; ++t) { a[x[t]] = v[t]; vector<int> b = a; int ans = 0; for(int i = 0; i < n; ++i) { bool sorted = 1; for(int j = 0; j + 1 < n; ++j) { if(b[j] > b[j + 1]) { sorted = 0; break; } } if(sorted) { break; } ++ans; for(int j = 0; j + 1 < n; ++j) { if(b[j] > b[j + 1]) { swap(b[j], b[j + 1]); } } } ret.push_back(ans); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...