Submission #335782

# Submission time Handle Problem Language Result Execution time Memory
335782 2020-12-14T02:30:45 Z Mo_TOI_I_am_Garbage Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
5 ms 748 KB
#include "bubblesort2.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V)
{
	int ans = 0;
	for(int i=1; i < (int)A.size(); i ++)
		if(A[i] < A[i - 1]) ans ++;
	vector<int> res;
	for(int i=0; i < (int)X.size(); i ++)
	{
		if(X[i] > 0 && A[X[i]] < A[X[i] - 1]) ans --;
		if(X[i] < (int)A.size() - 1 && A[X[i]] > A[X[i] + 1]) ans --;
		A[X[i]] = V[i];
		if(X[i] > 0 && A[X[i]] < A[X[i] - 1]) ans ++;
		if(X[i] < (int)A.size() - 1 && A[X[i]] > A[X[i] + 1]) ans ++;
		res.push_back(ans);
	}
	return res;
}


// int readInt(){
// 	int i;
// 	if(scanf("%d",&i)!=1){
// 		fprintf(stderr,"Error while reading input\n");
// 		exit(1);
// 	}
// 	return i;
// }

// int main(){
// 	int N,Q;
// 	N=readInt();
// 	Q=readInt();
	
// 	std::vector<int> A(N);
// 	for(int i=0;i<N;i++)
// 		A[i]=readInt();
	
// 	std::vector<int> X(Q),V(Q);
// 	for(int j=0;j<Q;j++){
// 		X[j]=readInt();
// 		V[j]=readInt();
// 	}

// 	std::vector<int> res=countScans(A,X,V);
	

// 	for(int j=0;j<int(res.size());j++)
// 		printf("%d\n",res[j]);
// }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -