답안 #1089575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1089575 2024-09-16T17:16:42 Z VMaksimoski008 Bubble Sort 2 (JOI18_bubblesort2) C++17
38 / 100
9000 ms 2776 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

const int maxn = 5e5 + 5;

struct BIT {
	int n;
	vector<int> tree;

	BIT(int _n) : n(_n+10), tree(_n+60) {}

	void update(int p) {
		for(p++; p<n; p+=p&-p) tree[p]++;
	}

	int query(int p) {
		int ans = 0;
		for(p++; p>0; p-=p&-p) ans += tree[p];
		return ans;
	}

	void clear() { for(int &x : tree) x = 0; }
};

vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
	int n = A.size(), q = X.size();

	vector<int> ans(q);
	BIT bit(n);
	for(int it=0; it<q; it++) {
		A[X[it]] = V[it];
		bit.clear();
		vector<pii> vec;
		for(int i=0; i<n; i++) vec.push_back({ A[i], i });
		sort(vec.rbegin(), vec.rend());
		for(auto &[val, id] : vec) {
			ans[it] = max(ans[it], bit.query(id));
			bit.update(id);
		}
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 344 KB Output is correct
2 Correct 35 ms 348 KB Output is correct
3 Correct 263 ms 552 KB Output is correct
4 Correct 257 ms 600 KB Output is correct
5 Correct 241 ms 344 KB Output is correct
6 Correct 158 ms 344 KB Output is correct
7 Correct 211 ms 344 KB Output is correct
8 Correct 224 ms 552 KB Output is correct
9 Correct 247 ms 548 KB Output is correct
10 Correct 263 ms 344 KB Output is correct
11 Correct 265 ms 348 KB Output is correct
12 Correct 271 ms 348 KB Output is correct
13 Correct 262 ms 344 KB Output is correct
14 Correct 261 ms 544 KB Output is correct
15 Correct 264 ms 344 KB Output is correct
16 Correct 255 ms 344 KB Output is correct
17 Correct 255 ms 344 KB Output is correct
18 Correct 263 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 344 KB Output is correct
2 Correct 35 ms 348 KB Output is correct
3 Correct 263 ms 552 KB Output is correct
4 Correct 257 ms 600 KB Output is correct
5 Correct 241 ms 344 KB Output is correct
6 Correct 158 ms 344 KB Output is correct
7 Correct 211 ms 344 KB Output is correct
8 Correct 224 ms 552 KB Output is correct
9 Correct 247 ms 548 KB Output is correct
10 Correct 263 ms 344 KB Output is correct
11 Correct 265 ms 348 KB Output is correct
12 Correct 271 ms 348 KB Output is correct
13 Correct 262 ms 344 KB Output is correct
14 Correct 261 ms 544 KB Output is correct
15 Correct 264 ms 344 KB Output is correct
16 Correct 255 ms 344 KB Output is correct
17 Correct 255 ms 344 KB Output is correct
18 Correct 263 ms 348 KB Output is correct
19 Correct 3924 ms 856 KB Output is correct
20 Correct 5067 ms 980 KB Output is correct
21 Correct 4283 ms 856 KB Output is correct
22 Correct 4946 ms 988 KB Output is correct
23 Correct 5304 ms 968 KB Output is correct
24 Correct 5457 ms 952 KB Output is correct
25 Correct 5366 ms 1112 KB Output is correct
26 Correct 5413 ms 944 KB Output is correct
27 Correct 5394 ms 860 KB Output is correct
28 Correct 5441 ms 944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6163 ms 1352 KB Output is correct
2 Execution timed out 9041 ms 2776 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 344 KB Output is correct
2 Correct 35 ms 348 KB Output is correct
3 Correct 263 ms 552 KB Output is correct
4 Correct 257 ms 600 KB Output is correct
5 Correct 241 ms 344 KB Output is correct
6 Correct 158 ms 344 KB Output is correct
7 Correct 211 ms 344 KB Output is correct
8 Correct 224 ms 552 KB Output is correct
9 Correct 247 ms 548 KB Output is correct
10 Correct 263 ms 344 KB Output is correct
11 Correct 265 ms 348 KB Output is correct
12 Correct 271 ms 348 KB Output is correct
13 Correct 262 ms 344 KB Output is correct
14 Correct 261 ms 544 KB Output is correct
15 Correct 264 ms 344 KB Output is correct
16 Correct 255 ms 344 KB Output is correct
17 Correct 255 ms 344 KB Output is correct
18 Correct 263 ms 348 KB Output is correct
19 Correct 3924 ms 856 KB Output is correct
20 Correct 5067 ms 980 KB Output is correct
21 Correct 4283 ms 856 KB Output is correct
22 Correct 4946 ms 988 KB Output is correct
23 Correct 5304 ms 968 KB Output is correct
24 Correct 5457 ms 952 KB Output is correct
25 Correct 5366 ms 1112 KB Output is correct
26 Correct 5413 ms 944 KB Output is correct
27 Correct 5394 ms 860 KB Output is correct
28 Correct 5441 ms 944 KB Output is correct
29 Correct 6163 ms 1352 KB Output is correct
30 Execution timed out 9041 ms 2776 KB Time limit exceeded
31 Halted 0 ms 0 KB -