Submission #102447

# Submission time Handle Problem Language Result Execution time Memory
102447 2019-03-25T03:34:22 Z DrumpfTheGodEmperor Bubble Sort 2 (JOI18_bubblesort2) C++14
Compilation error
0 ms 0 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];
vector<int> 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();
	vector<int> lol;
	fw (i, 0, n) {
		fw (j, i + 1, n) if (a[i] > a[j]) ans[j]++;
	}
	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]);
		lol.pb(res);
	}
	return lol;
}
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	vector<int> hi = countScans({1, 2, 3, 4}, {0, 3}, {1, 3});
	fa (i, hi) cout << i << "\n";
	return 0;
}

Compilation message

/tmp/ccVdcKfa.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccg59bNF.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status