Submission #234663

# Submission time Handle Problem Language Result Execution time Memory
234663 2020-05-25T04:45:41 Z LittleFlowers__ Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
9000 ms 640 KB
#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;

vector<int> countScans(vector<int> a,vector<int> x,vector<int> v){
    vector<int> res;
    for(int i=0;i<x.size();++i){
        a[x[i]]=v[i];
        vector<int> b=a;
        for(int ans=0;;){
            int has=0;
            for(int j=1;j<a.size();++j){
                if(b[j-1]>b[j]){
                    has=1;
                    swap(b[j-1],b[j]);
                }
            }
            if(!has){
                res.push_back(ans);
                break;
            } ++ans;
        }
    }
    return res;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:7:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<x.size();++i){
                 ~^~~~~~~~~
bubblesort2.cpp:12:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=1;j<a.size();++j){
                         ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 251 ms 376 KB Output is correct
2 Correct 896 ms 632 KB Output is correct
3 Execution timed out 9046 ms 632 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 376 KB Output is correct
2 Correct 896 ms 632 KB Output is correct
3 Execution timed out 9046 ms 632 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9010 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 376 KB Output is correct
2 Correct 896 ms 632 KB Output is correct
3 Execution timed out 9046 ms 632 KB Time limit exceeded
4 Halted 0 ms 0 KB -