답안 #925322

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925322 2024-02-11T12:12:56 Z boris_mihov Bubble Sort 2 (JOI18_bubblesort2) C++17
17 / 100
9000 ms 2652 KB
#include "bubblesort2.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <stack>

typedef long long llong;
const int MAXN = 500000 + 10;
const int INF  = 1e9;

int n, q;
int a[MAXN];
int in[MAXN];
int order[MAXN];

std::vector <int> countScans(std::vector <int> A, std::vector <int> X, std::vector <int> V)
{
    n = A.size();
    q = X.size();

    for (int i = 1 ; i <= n ; ++i)
    {
        a[i] = A[i - 1];
    }

    std::vector <int> answer(q, 0);
    for (int query = 0 ; query < q ; ++query)
    {
        a[X[query] + 1] = V[query];
        for (int i = 1 ; i <= n ; ++i)
        {
            int curr = 0;
            for (int j = 1 ; j < i ; ++j)
            {
                curr += (a[j] > a[i]);
            }

            answer[query] = std::max(answer[query], curr);
        }
    }

    return answer;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2392 KB Output is correct
2 Correct 174 ms 2524 KB Output is correct
3 Correct 2438 ms 2644 KB Output is correct
4 Correct 2468 ms 2572 KB Output is correct
5 Correct 2430 ms 2572 KB Output is correct
6 Correct 2445 ms 2572 KB Output is correct
7 Correct 2437 ms 2568 KB Output is correct
8 Correct 2456 ms 2572 KB Output is correct
9 Correct 2458 ms 2572 KB Output is correct
10 Correct 2429 ms 2568 KB Output is correct
11 Correct 2440 ms 2560 KB Output is correct
12 Correct 2444 ms 2580 KB Output is correct
13 Correct 2442 ms 2564 KB Output is correct
14 Correct 2440 ms 2560 KB Output is correct
15 Correct 2457 ms 2564 KB Output is correct
16 Correct 2442 ms 2564 KB Output is correct
17 Correct 2446 ms 2564 KB Output is correct
18 Correct 2424 ms 2564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2392 KB Output is correct
2 Correct 174 ms 2524 KB Output is correct
3 Correct 2438 ms 2644 KB Output is correct
4 Correct 2468 ms 2572 KB Output is correct
5 Correct 2430 ms 2572 KB Output is correct
6 Correct 2445 ms 2572 KB Output is correct
7 Correct 2437 ms 2568 KB Output is correct
8 Correct 2456 ms 2572 KB Output is correct
9 Correct 2458 ms 2572 KB Output is correct
10 Correct 2429 ms 2568 KB Output is correct
11 Correct 2440 ms 2560 KB Output is correct
12 Correct 2444 ms 2580 KB Output is correct
13 Correct 2442 ms 2564 KB Output is correct
14 Correct 2440 ms 2560 KB Output is correct
15 Correct 2457 ms 2564 KB Output is correct
16 Correct 2442 ms 2564 KB Output is correct
17 Correct 2446 ms 2564 KB Output is correct
18 Correct 2424 ms 2564 KB Output is correct
19 Execution timed out 9041 ms 2652 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 9065 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2392 KB Output is correct
2 Correct 174 ms 2524 KB Output is correct
3 Correct 2438 ms 2644 KB Output is correct
4 Correct 2468 ms 2572 KB Output is correct
5 Correct 2430 ms 2572 KB Output is correct
6 Correct 2445 ms 2572 KB Output is correct
7 Correct 2437 ms 2568 KB Output is correct
8 Correct 2456 ms 2572 KB Output is correct
9 Correct 2458 ms 2572 KB Output is correct
10 Correct 2429 ms 2568 KB Output is correct
11 Correct 2440 ms 2560 KB Output is correct
12 Correct 2444 ms 2580 KB Output is correct
13 Correct 2442 ms 2564 KB Output is correct
14 Correct 2440 ms 2560 KB Output is correct
15 Correct 2457 ms 2564 KB Output is correct
16 Correct 2442 ms 2564 KB Output is correct
17 Correct 2446 ms 2564 KB Output is correct
18 Correct 2424 ms 2564 KB Output is correct
19 Execution timed out 9041 ms 2652 KB Time limit exceeded
20 Halted 0 ms 0 KB -