답안 #1019819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019819 2024-07-11T09:15:27 Z NValchanov 곤돌라 (IOI14_gondola) C++17
35 / 100
13 ms 2316 KB
#include <bits/stdc++.h>
#include "gondola.h"

#define endl '\n'

using namespace std;

typedef long long ll;

int valid(int n, int inputSeq[])
{
  return -1;
}

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

int replacement(int n, int a[], int ans[])
{
    int min_idx = 0;
    int maxel = 0;

    for(int i = 0; i < n; i++)
    {
        if(a[i] < a[min_idx])
            min_idx = i;
        
        maxel = max(maxel, a[i]);
    }

    vector < int > order;

    for(int i = min_idx; i < n; i++)
    {
        order.push_back(a[i]);
    }
    for(int i = 0; i < min_idx; i++)
    {
        order.push_back(a[i]);
    }

    vector < pair < int, int > > broken;

    for(int i = 0; i < n; i++)
    {
        if(order[i] > n)
            broken.push_back({order[i], i});
    }

    sort(broken.begin(), broken.end());

    if(order.front() > n)
        order.front() = 1;

    for(int i = 1; i < n; i++)
    {
        if(order[i - 1] == n)
        {
            order[i] = 1;
        }
        else
        {
            order[i] = order[i - 1] + 1;
        }
    }

    int last = n;
    int pos = 0;

    for(pair < int, int > p : broken)
    {
        int val = p.first;
        int idx = p.second;

        while(last < val)
        {
            ans[pos++] = order[idx];
            order[idx] = ++last;
        }
    }

    return maxel - n;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 7 ms 1752 KB Output is correct
12 Correct 7 ms 1752 KB Output is correct
13 Correct 9 ms 1616 KB Output is correct
14 Correct 6 ms 1748 KB Output is correct
15 Correct 13 ms 2316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 440 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -