Submission #1013570

#TimeUsernameProblemLanguageResultExecution timeMemory
1013570vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
17 / 100
9062 ms1600 KiB
#include <bits/stdc++.h> #define mod 1000000007LL #define inf 1e17 #define ll long long using namespace std; void printvec(vector<int> vec) { for (auto &&e : vec) { cout << e << ' '; } cout << endl; } vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) { vector<int> s; for (int j = 0; j < x.size(); j++) { a[x[j]] = v[j]; vector<int> a_sorted = a; sort(a_sorted.begin(), a_sorted.end()); // for (auto& e:a_sorted) cout << e << ' '; // cout << endl; map<ll,ll> ind; for (int i = 0; i < a.size(); i++) { ind[a_sorted[i]] = i; } ll maxe = 0; for (int i = 0; i < a.size(); i++) { if(i > ind[a[i]]) { maxe = max(maxe, i - ind[a[i]]); } } s.push_back(maxe); } return s; }

Compilation message (stderr)

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:19:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int j = 0; j < x.size(); j++)
      |                     ~~^~~~~~~~~~
bubblesort2.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for (int i = 0; i < a.size(); i++)
      |                     ~~^~~~~~~~~~
bubblesort2.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i = 0; i < a.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...