Submission #199367

# Submission time Handle Problem Language Result Execution time Memory
199367 2020-01-31T17:29:12 Z mahmoudbadawy Bubble Sort 2 (JOI18_bubblesort2) C++17
38 / 100
9000 ms 1864 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;

const int N=500005;
pair<int,int> arr[N];

vector<int> countScans(vector<int> A,vector<int> X,vector<int> V)
{
	int n=A.size();
	vector<int> v;
	for(int i=0;i<X.size();i++)
	{
		A[X[i]]=V[i];
		for(int i=0;i<n;i++)
		{
			arr[i].F=A[i]; arr[i].S=i;
		}
		sort(arr,arr+n);
		int ans=0;
		for(int i=0;i<n;i++) ans=max(ans,max(arr[i].S-i,0));
		v.push_back(ans);
	}
	return v;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<X.size();i++)
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 39 ms 376 KB Output is correct
3 Correct 226 ms 504 KB Output is correct
4 Correct 224 ms 504 KB Output is correct
5 Correct 213 ms 504 KB Output is correct
6 Correct 140 ms 512 KB Output is correct
7 Correct 179 ms 504 KB Output is correct
8 Correct 200 ms 504 KB Output is correct
9 Correct 216 ms 504 KB Output is correct
10 Correct 130 ms 484 KB Output is correct
11 Correct 130 ms 376 KB Output is correct
12 Correct 133 ms 512 KB Output is correct
13 Correct 130 ms 524 KB Output is correct
14 Correct 131 ms 504 KB Output is correct
15 Correct 130 ms 504 KB Output is correct
16 Correct 115 ms 504 KB Output is correct
17 Correct 119 ms 504 KB Output is correct
18 Correct 112 ms 608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 39 ms 376 KB Output is correct
3 Correct 226 ms 504 KB Output is correct
4 Correct 224 ms 504 KB Output is correct
5 Correct 213 ms 504 KB Output is correct
6 Correct 140 ms 512 KB Output is correct
7 Correct 179 ms 504 KB Output is correct
8 Correct 200 ms 504 KB Output is correct
9 Correct 216 ms 504 KB Output is correct
10 Correct 130 ms 484 KB Output is correct
11 Correct 130 ms 376 KB Output is correct
12 Correct 133 ms 512 KB Output is correct
13 Correct 130 ms 524 KB Output is correct
14 Correct 131 ms 504 KB Output is correct
15 Correct 130 ms 504 KB Output is correct
16 Correct 115 ms 504 KB Output is correct
17 Correct 119 ms 504 KB Output is correct
18 Correct 112 ms 608 KB Output is correct
19 Correct 3267 ms 1156 KB Output is correct
20 Correct 4306 ms 1272 KB Output is correct
21 Correct 3622 ms 1016 KB Output is correct
22 Correct 4135 ms 1016 KB Output is correct
23 Correct 2406 ms 1032 KB Output is correct
24 Correct 2442 ms 1144 KB Output is correct
25 Correct 2371 ms 1148 KB Output is correct
26 Correct 2406 ms 1308 KB Output is correct
27 Correct 2385 ms 1000 KB Output is correct
28 Correct 2390 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5679 ms 1248 KB Output is correct
2 Execution timed out 9093 ms 1864 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 39 ms 376 KB Output is correct
3 Correct 226 ms 504 KB Output is correct
4 Correct 224 ms 504 KB Output is correct
5 Correct 213 ms 504 KB Output is correct
6 Correct 140 ms 512 KB Output is correct
7 Correct 179 ms 504 KB Output is correct
8 Correct 200 ms 504 KB Output is correct
9 Correct 216 ms 504 KB Output is correct
10 Correct 130 ms 484 KB Output is correct
11 Correct 130 ms 376 KB Output is correct
12 Correct 133 ms 512 KB Output is correct
13 Correct 130 ms 524 KB Output is correct
14 Correct 131 ms 504 KB Output is correct
15 Correct 130 ms 504 KB Output is correct
16 Correct 115 ms 504 KB Output is correct
17 Correct 119 ms 504 KB Output is correct
18 Correct 112 ms 608 KB Output is correct
19 Correct 3267 ms 1156 KB Output is correct
20 Correct 4306 ms 1272 KB Output is correct
21 Correct 3622 ms 1016 KB Output is correct
22 Correct 4135 ms 1016 KB Output is correct
23 Correct 2406 ms 1032 KB Output is correct
24 Correct 2442 ms 1144 KB Output is correct
25 Correct 2371 ms 1148 KB Output is correct
26 Correct 2406 ms 1308 KB Output is correct
27 Correct 2385 ms 1000 KB Output is correct
28 Correct 2390 ms 1024 KB Output is correct
29 Correct 5679 ms 1248 KB Output is correct
30 Execution timed out 9093 ms 1864 KB Time limit exceeded
31 Halted 0 ms 0 KB -