Submission #1013570

# Submission time Handle Problem Language Result Execution time Memory
1013570 2024-07-03T16:35:01 Z vjudge1 Bubble Sort 2 (JOI18_bubblesort2) C++17
17 / 100
9000 ms 1600 KB
#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

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 time Memory Grader output
1 Correct 39 ms 344 KB Output is correct
2 Correct 121 ms 524 KB Output is correct
3 Correct 804 ms 640 KB Output is correct
4 Correct 746 ms 648 KB Output is correct
5 Correct 813 ms 648 KB Output is correct
6 Correct 720 ms 632 KB Output is correct
7 Correct 808 ms 740 KB Output is correct
8 Correct 715 ms 652 KB Output is correct
9 Correct 721 ms 632 KB Output is correct
10 Correct 600 ms 640 KB Output is correct
11 Correct 595 ms 624 KB Output is correct
12 Correct 600 ms 624 KB Output is correct
13 Correct 664 ms 648 KB Output is correct
14 Correct 618 ms 648 KB Output is correct
15 Correct 578 ms 644 KB Output is correct
16 Correct 574 ms 632 KB Output is correct
17 Correct 555 ms 640 KB Output is correct
18 Correct 580 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 344 KB Output is correct
2 Correct 121 ms 524 KB Output is correct
3 Correct 804 ms 640 KB Output is correct
4 Correct 746 ms 648 KB Output is correct
5 Correct 813 ms 648 KB Output is correct
6 Correct 720 ms 632 KB Output is correct
7 Correct 808 ms 740 KB Output is correct
8 Correct 715 ms 652 KB Output is correct
9 Correct 721 ms 632 KB Output is correct
10 Correct 600 ms 640 KB Output is correct
11 Correct 595 ms 624 KB Output is correct
12 Correct 600 ms 624 KB Output is correct
13 Correct 664 ms 648 KB Output is correct
14 Correct 618 ms 648 KB Output is correct
15 Correct 578 ms 644 KB Output is correct
16 Correct 574 ms 632 KB Output is correct
17 Correct 555 ms 640 KB Output is correct
18 Correct 580 ms 644 KB Output is correct
19 Execution timed out 9033 ms 1112 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3817 ms 856 KB Output is correct
2 Execution timed out 9062 ms 1600 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 344 KB Output is correct
2 Correct 121 ms 524 KB Output is correct
3 Correct 804 ms 640 KB Output is correct
4 Correct 746 ms 648 KB Output is correct
5 Correct 813 ms 648 KB Output is correct
6 Correct 720 ms 632 KB Output is correct
7 Correct 808 ms 740 KB Output is correct
8 Correct 715 ms 652 KB Output is correct
9 Correct 721 ms 632 KB Output is correct
10 Correct 600 ms 640 KB Output is correct
11 Correct 595 ms 624 KB Output is correct
12 Correct 600 ms 624 KB Output is correct
13 Correct 664 ms 648 KB Output is correct
14 Correct 618 ms 648 KB Output is correct
15 Correct 578 ms 644 KB Output is correct
16 Correct 574 ms 632 KB Output is correct
17 Correct 555 ms 640 KB Output is correct
18 Correct 580 ms 644 KB Output is correct
19 Execution timed out 9033 ms 1112 KB Time limit exceeded
20 Halted 0 ms 0 KB -