답안 #363189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363189 2021-02-05T09:07:05 Z r57shell Bubble Sort 2 (JOI18_bubblesort2) C++14
17 / 100
9000 ms 620 KB
#include "bubblesort2.h"

using namespace std;

static int stupid(vector<int> A)
{
	int res = 0;
	int n = A.size();
	while (true)
	{
		bool was = false;
		for (int i = 1; i < n; ++i)
		{
			if (A[i-1] > A[i])
			{
				swap(A[i-1], A[i]);
				was = true;
			}
		}
		if (was)
			++res;
		else
			break;
	}
	return res;
}

static int stupid1(vector<int> A)
{
	int n = A.size();
	int res = 0;
	for (int i = 1; i < n; ++i)
	{
		int c = 0;
		for (int j = 0; j < i; ++j)
			if (A[i] < A[j])
				++c;
		res = max(res, c);
	}
	return res;
}

vector<int> countScans(vector<int> A, vector<int> X, vector<int> V)
{
	int Q = X.size();
	vector<int> answer(Q);
	for (int j = 0; j < Q; j++)
	{
		A[X[j]] = V[j];
		answer[j] = stupid1(A);
	}
	return answer;
}

Compilation message

bubblesort2.cpp:5:12: warning: 'int stupid(std::vector<int>)' defined but not used [-Wunused-function]
    5 | static int stupid(vector<int> A)
      |            ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 364 KB Output is correct
2 Correct 216 ms 492 KB Output is correct
3 Correct 3064 ms 420 KB Output is correct
4 Correct 3096 ms 468 KB Output is correct
5 Correct 3073 ms 468 KB Output is correct
6 Correct 3137 ms 492 KB Output is correct
7 Correct 3088 ms 468 KB Output is correct
8 Correct 3053 ms 468 KB Output is correct
9 Correct 3058 ms 492 KB Output is correct
10 Correct 3072 ms 492 KB Output is correct
11 Correct 3052 ms 492 KB Output is correct
12 Correct 3061 ms 364 KB Output is correct
13 Correct 3081 ms 492 KB Output is correct
14 Correct 3125 ms 492 KB Output is correct
15 Correct 3109 ms 492 KB Output is correct
16 Correct 3094 ms 492 KB Output is correct
17 Correct 3103 ms 460 KB Output is correct
18 Correct 3125 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 364 KB Output is correct
2 Correct 216 ms 492 KB Output is correct
3 Correct 3064 ms 420 KB Output is correct
4 Correct 3096 ms 468 KB Output is correct
5 Correct 3073 ms 468 KB Output is correct
6 Correct 3137 ms 492 KB Output is correct
7 Correct 3088 ms 468 KB Output is correct
8 Correct 3053 ms 468 KB Output is correct
9 Correct 3058 ms 492 KB Output is correct
10 Correct 3072 ms 492 KB Output is correct
11 Correct 3052 ms 492 KB Output is correct
12 Correct 3061 ms 364 KB Output is correct
13 Correct 3081 ms 492 KB Output is correct
14 Correct 3125 ms 492 KB Output is correct
15 Correct 3109 ms 492 KB Output is correct
16 Correct 3094 ms 492 KB Output is correct
17 Correct 3103 ms 460 KB Output is correct
18 Correct 3125 ms 364 KB Output is correct
19 Execution timed out 9097 ms 620 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 9090 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 364 KB Output is correct
2 Correct 216 ms 492 KB Output is correct
3 Correct 3064 ms 420 KB Output is correct
4 Correct 3096 ms 468 KB Output is correct
5 Correct 3073 ms 468 KB Output is correct
6 Correct 3137 ms 492 KB Output is correct
7 Correct 3088 ms 468 KB Output is correct
8 Correct 3053 ms 468 KB Output is correct
9 Correct 3058 ms 492 KB Output is correct
10 Correct 3072 ms 492 KB Output is correct
11 Correct 3052 ms 492 KB Output is correct
12 Correct 3061 ms 364 KB Output is correct
13 Correct 3081 ms 492 KB Output is correct
14 Correct 3125 ms 492 KB Output is correct
15 Correct 3109 ms 492 KB Output is correct
16 Correct 3094 ms 492 KB Output is correct
17 Correct 3103 ms 460 KB Output is correct
18 Correct 3125 ms 364 KB Output is correct
19 Execution timed out 9097 ms 620 KB Time limit exceeded
20 Halted 0 ms 0 KB -