Submission #25843

# Submission time Handle Problem Language Result Execution time Memory
25843 2017-06-24T11:18:15 Z szawinis Kralj (COCI16_kralj) C++14
0 / 140
523 ms 20232 KB
#include <bits/stdc++.h>
using namespace std;
const int MAX = (3e5)+1;

int n, start, ans, a[MAX], tmp[MAX], d[MAX], e[MAX];
bool mark[MAX];
multiset<int> st;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i], --a[i];
	copy(a, a+n, tmp);
	sort(tmp, tmp+n);
	int curr = 0;
	for(int x: tmp) {
		if(mark[x]) curr = (curr+1)%n;
		else curr = start = x;
		mark[curr] = true;
	}
	for(int i = 0; i < n; i++) cin >> d[i];
	for(int i = 0, x; i < n; i++) {
		cin >> x;
		st.insert(x);
	}
	for(int z = 0, i = 0; z < n; z++, i = (i+1)%n) {
		auto it = st.lower_bound(d[i]);
		if(it != st.end()) ans++, st.erase(it);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 7164 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Runtime error 23 ms 7164 KB Execution killed with signal 8 (could be triggered by violating memory limits)
3 Runtime error 26 ms 7164 KB Execution killed with signal 8 (could be triggered by violating memory limits)
4 Runtime error 23 ms 7164 KB Execution killed with signal 8 (could be triggered by violating memory limits)
5 Runtime error 33 ms 7164 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Incorrect 239 ms 14952 KB Output isn't correct
7 Incorrect 296 ms 17988 KB Output isn't correct
8 Incorrect 523 ms 20232 KB Output isn't correct
9 Runtime error 33 ms 7164 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 46 ms 7164 KB Execution killed with signal 11 (could be triggered by violating memory limits)