Submission #163905

# Submission time Handle Problem Language Result Execution time Memory
163905 2019-11-16T06:55:07 Z oolimry Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
9000 ms 1296 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> countScans(vector<int> arr, vector<int> X, vector<int> V){
	int q = X.size();
	int n = arr.size();
	vector<int> answer;
	
	for(int qq = 0;qq < q;qq++){
		arr[X[qq]] = V[qq];
		vector<int> L;
		int maxV = 0;
		
		vector<int> s;
		for(int i = 0;i < arr.size();i++) s.push_back(arr[i]);
		sort(s.begin(),s.end());
		
		for(int i = 0;i < n;i++){
			int a = abs(i - (lower_bound(s.begin(),s.end(),arr[i]) - s.begin()));
			int b = abs(i - (upper_bound(s.begin(),s.end(),arr[i]) - s.begin()) + 1);
			maxV = max(maxV, min(a,b));
		}
		answer.push_back(maxV);
	}
	return answer;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0;i < arr.size();i++) s.push_back(arr[i]);
                 ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9080 ms 1296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -