Submission #746482

#TimeUsernameProblemLanguageResultExecution timeMemory
746482nguyentunglamBubble Sort 2 (JOI18_bubblesort2)C++17
0 / 100
9092 ms596 KiB
#include<bits/stdc++.h> #define fi first #define se second #define endl "\n" #define ii pair<int, int> using namespace std; vector<int> countScans(vector<int> a, vector<int> pos, vector<int> val) { vector<int> ans(pos.size()); int n = a.size(); for(int i = 0; i < pos.size(); i++) { a[pos[i]] = val[i]; for(int j = 0; j < n; j++) { int tmp = 0; for(int k = 0; k < j; k++) if (a[j] < a[k]) tmp++; ans[i] = max(ans[i], tmp); } } return ans; } #ifdef ngu int main() { freopen ("task.inp", "r", stdin); freopen ("task.out", "w", stdout); int n, q; cin >> n >> q; vector<int> a(n), x(q), v(q); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < q; i++) cin >> x[i] >> v[i]; vector<int> ret = countScans(a, x, v); for(int &j : ret) cout << j << endl; } #endif // ngu

Compilation message (stderr)

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < pos.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...