Submission #363332

#TimeUsernameProblemLanguageResultExecution timeMemory
363332buyolitsezBubble Sort 2 (JOI18_bubblesort2)C++17
0 / 100
5 ms1132 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #define eb emplace_back typedef long long ll; const ll ADD = 1000000; std::vector<int> countScans(std::vector<int> aa,std::vector<int> xx,std::vector<int> vv){ vector <ll> a, x, v; for (auto u : a) { a.eb(u); } for (int i = 0; i < xx.size(); ++i) { x.eb(xx[i]); v.eb(vv[i]); } int n = a.size(), q = x.size(); vector <int> s(q, n - 1); for (int i = 0; i < n; ++i) { a[i] = a[i] * ADD + i; } for(int f = 0; f < q; ++f) { a[x[f]] = v[f] * ADD + x[f]; ll mx = 0; for (int i = 0; i < n; ++i) { ll cnt = 0; for (int j = 0; j < i; ++j) { if (a[j] > a[i]) { ++cnt; } } mx = max(mx, cnt); } s[f] = mx; } return s; }

Compilation message (stderr)

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for (int i = 0; i < xx.size(); ++i) {
      |                     ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...