Submission #235166

# Submission time Handle Problem Language Result Execution time Memory
235166 2020-05-27T08:11:31 Z Atalasion Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
2823 ms 992 KB
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-O2")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 500000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int a[N], n, q, cnt[N];

vector<int> countScans(vi A, vi X, vi V){
	n = A.size();
	q = X.size();
	for (int i = 1; i <= n; i++){
		a[i] = A[i - 1];
	}
	for (int i = 1; i <= n; i++) for (int j = 1; j < n; j++) if (a[j] > a[i]) cnt[i]++;
	vector<int> res;
	for (int i = 0; i < q; i++){
		for (int j = X[i] + 1; j <= n; j++)if(a[X[i]] > a[j]) cnt[j]--;
		cnt[X[i]] = 0;
		a[X[i]] = V[i];
		for(int j = 1; j < X[i]; j++) if (a[j] > V[i]) cnt[X[i]]++;
		for (int j = X[i] + 1; j <= n; j++) if (V[i] > a[j]) cnt[j]++;
		int mx = 0;
		for( int j = 1; j <= n; j++) mx = max(mx, cnt[j]);
		res.pb(mx);
	}
	return res;
}
	



# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2823 ms 992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -