Submission #69242

# Submission time Handle Problem Language Result Execution time Memory
69242 2018-08-20T10:15:51 Z ekrem Bubble Sort 2 (JOI18_bubblesort2) C++
17 / 100
9000 ms 50072 KB
#include <bits/stdc++.h>
#include "bubblesort2.h"
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

typedef vector < int > vi;
set < int > s[N];

vi countScans(vi a, vi b, vi c){
	vi ans;
	for(int i = 0; i < int(b.size()); i++){
		int cvp = 0;
		a[b[i]] = c[i];
		vi d = a;
		// for(int i = 0; i < d.size(); i++)cout << d[i] << " ";cout << endl;
		sort(d.begin(), d.end());
		map < int , int > yer;
		for(int i = 0; i < int(d.size()); i++){
			if(i + 1 != int(d.size()) and d[i + 1] == d[i])
				continue;
			yer[d[i]] = i;
		}
		for(int i = 0; i < int(a.size()); i++)
			cvp = max(cvp, i - yer[a[i]]);
		ans.pb(cvp);
	}
	return ans;
}


// int main(){
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// 	int n,q;
// 	scanf("%d %d",&n ,&q);	
// 	vi a(n);
// 	for(int i=0;i<n;i++)
// 		scanf("%d",&a[i]);
// 	vi b(q), c(q);
// 	for(int j=0;j<q;j++){
// 		scanf("%d %d",&b[j], &c[j]);
// 	}
// 	vi cvp = countScans(a, b, c);
// 	for(int j=0;j<int(cvp.size());j++)
// 		printf("%d\n",cvp[j]);
// }
# Verdict Execution time Memory Grader output
1 Correct 126 ms 47352 KB Output is correct
2 Correct 282 ms 47352 KB Output is correct
3 Correct 1235 ms 47792 KB Output is correct
4 Correct 1116 ms 47792 KB Output is correct
5 Correct 1052 ms 47856 KB Output is correct
6 Correct 979 ms 48088 KB Output is correct
7 Correct 1004 ms 48204 KB Output is correct
8 Correct 1075 ms 48208 KB Output is correct
9 Correct 1136 ms 48212 KB Output is correct
10 Correct 965 ms 48340 KB Output is correct
11 Correct 968 ms 48360 KB Output is correct
12 Correct 905 ms 48396 KB Output is correct
13 Correct 1002 ms 48564 KB Output is correct
14 Correct 967 ms 48608 KB Output is correct
15 Correct 954 ms 48608 KB Output is correct
16 Correct 1056 ms 48628 KB Output is correct
17 Correct 1061 ms 48628 KB Output is correct
18 Correct 986 ms 48708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 126 ms 47352 KB Output is correct
2 Correct 282 ms 47352 KB Output is correct
3 Correct 1235 ms 47792 KB Output is correct
4 Correct 1116 ms 47792 KB Output is correct
5 Correct 1052 ms 47856 KB Output is correct
6 Correct 979 ms 48088 KB Output is correct
7 Correct 1004 ms 48204 KB Output is correct
8 Correct 1075 ms 48208 KB Output is correct
9 Correct 1136 ms 48212 KB Output is correct
10 Correct 965 ms 48340 KB Output is correct
11 Correct 968 ms 48360 KB Output is correct
12 Correct 905 ms 48396 KB Output is correct
13 Correct 1002 ms 48564 KB Output is correct
14 Correct 967 ms 48608 KB Output is correct
15 Correct 954 ms 48608 KB Output is correct
16 Correct 1056 ms 48628 KB Output is correct
17 Correct 1061 ms 48628 KB Output is correct
18 Correct 986 ms 48708 KB Output is correct
19 Execution timed out 9064 ms 49260 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6010 ms 49260 KB Output is correct
2 Execution timed out 9028 ms 50072 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 126 ms 47352 KB Output is correct
2 Correct 282 ms 47352 KB Output is correct
3 Correct 1235 ms 47792 KB Output is correct
4 Correct 1116 ms 47792 KB Output is correct
5 Correct 1052 ms 47856 KB Output is correct
6 Correct 979 ms 48088 KB Output is correct
7 Correct 1004 ms 48204 KB Output is correct
8 Correct 1075 ms 48208 KB Output is correct
9 Correct 1136 ms 48212 KB Output is correct
10 Correct 965 ms 48340 KB Output is correct
11 Correct 968 ms 48360 KB Output is correct
12 Correct 905 ms 48396 KB Output is correct
13 Correct 1002 ms 48564 KB Output is correct
14 Correct 967 ms 48608 KB Output is correct
15 Correct 954 ms 48608 KB Output is correct
16 Correct 1056 ms 48628 KB Output is correct
17 Correct 1061 ms 48628 KB Output is correct
18 Correct 986 ms 48708 KB Output is correct
19 Execution timed out 9064 ms 49260 KB Time limit exceeded
20 Halted 0 ms 0 KB -