답안 #421356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
421356 2021-06-09T05:32:37 Z 조영욱(#7654) Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
2164 ms 640 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<<j);
            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]) {
      |                 ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2164 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -