답안 #102445

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102445 2019-03-25T03:29:03 Z DrumpfTheGodEmperor Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
6 ms 896 KB
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 8005;
int n, q, ans[N];
void countScans(vector<int> a, vector<int> x, vector<int> v) {
	//Count for each i how many numbers to its left > a[i]
	n = a.size(), q = x.size();
	fw (i, 0, q) {
		int pos = x[i], val = v[i];
		ans[pos] = 0;
		fw (j, 0, pos) if (a[j] > val) ans[pos]++;
		fw (j, pos + 1, n) {
			if (a[pos] > a[j]) ans[j]--;
			if (val > a[j]) ans[j]++;
		}
		a[pos] = val;
		int res = 0;
		fw (j, 0, n) res = max(res, ans[j]);
		cout << res << "\n";
	}
}
//signed main() {
//	#ifdef BLU
//	in("blu.inp");
//	#endif
//	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//	countScans({1, 2, 3, 4}, {0, 2}, {3, 1});
//	return 0;
//}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -