Submission #421351

# Submission time Handle Problem Language Result Execution time Memory
421351 2021-06-09T05:29:34 Z 조영욱(#7654) Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
1422 ms 724 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;

const int INF=1e9+1;

int cal(vector<int> v) {
    vector<int> vec;
    vec.push_back(INF);
    for(int i=0;i<v.size();i++) {
        if (vec.back()>v[i]) {
            vec.push_back(v[i]);
            continue;
        }
        int now=0;
        for(int j=15;j>=0;j--) {
            int nt=now+(1<<i);
            if (nt<vec.size()&&vec[nt]>v[i]) {
                now=nt;
            }
        }
        vec[now+1]=v[i];
    }
    return vec.size()-1;
}

vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){
	int q=X.size();
	vector<int> ret(q);
	for (int j=0;j<q;j++) {
		A[X[j]]=V[j];
		ret[j]=cal(A)-1;
	}
	return ret;
}

Compilation message

bubblesort2.cpp: In function 'int cal(std::vector<int>)':
bubblesort2.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<v.size();i++) {
      |                 ~^~~~~~~~~
bubblesort2.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             if (nt<vec.size()&&vec[nt]>v[i]) {
      |                 ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1422 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -