답안 #46761

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46761 2018-04-23T04:01:39 Z RayaBurong25_1 곤돌라 (IOI14_gondola) C++17
15 / 100
26 ms 4708 KB
#include "gondola.h"
#include <vector>
#include <algorithm>

int valid(int n, int inputSeq[])
{
    int i, r = -1;
    for (i = 0; i < n; i++)
    {
        if (inputSeq[i] <= n)
        {
            if (r == -1)
                r = (inputSeq[i] + n - i)%n;
            else if ((inputSeq[i] + n - i)%n != r)
                return 0;
        }
    }
    return 1;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
    int i, r = -1;
    for (i = 0; i < n; i++)
    {
        if (gondolaSeq[i] <= n)
        {
            if (r == -1)
            {
                r = (gondolaSeq[i] + n - i)%n;
                break;
            }
        }
    }
    std::vector<std::pair<int, int> > V;
    for (i = 0; i < n; i++)
    {
        if (gondolaSeq[i] > n)
        {
            V.push_back({gondolaSeq[i], i});
            gondolaSeq[i] = (i + (r - 1))%n + 1;
        }
    }
    if (V.size() == 0)
        return 0;
    std::sort(V.begin(), V.end());
    r = 0;
    int j = 0;
    for (i = n + 1; i <= V.back().first; i++)
    {
        replacementSeq[r] = gondolaSeq[V[j].second];
        if (V[j].first == i)
            j++;
        r++;
    }
    return r;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 684 KB Output is correct
2 Correct 2 ms 788 KB Output is correct
3 Correct 2 ms 788 KB Output is correct
4 Correct 2 ms 976 KB Output is correct
5 Correct 2 ms 976 KB Output is correct
6 Correct 7 ms 1132 KB Output is correct
7 Correct 14 ms 1984 KB Output is correct
8 Correct 15 ms 2248 KB Output is correct
9 Correct 5 ms 2248 KB Output is correct
10 Correct 26 ms 2920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2920 KB Output is correct
2 Correct 2 ms 2920 KB Output is correct
3 Correct 2 ms 2920 KB Output is correct
4 Correct 2 ms 2920 KB Output is correct
5 Correct 2 ms 2920 KB Output is correct
6 Correct 7 ms 2920 KB Output is correct
7 Correct 14 ms 3656 KB Output is correct
8 Correct 10 ms 4032 KB Output is correct
9 Correct 5 ms 4032 KB Output is correct
10 Correct 13 ms 4708 KB Output is correct
11 Incorrect 2 ms 4708 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4708 KB Output is correct
2 Correct 2 ms 4708 KB Output is correct
3 Correct 2 ms 4708 KB Output is correct
4 Correct 2 ms 4708 KB Output is correct
5 Correct 2 ms 4708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4708 KB Output is correct
2 Correct 2 ms 4708 KB Output is correct
3 Correct 2 ms 4708 KB Output is correct
4 Correct 2 ms 4708 KB Output is correct
5 Correct 2 ms 4708 KB Output is correct
6 Incorrect 2 ms 4708 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4708 KB Output is correct
2 Correct 2 ms 4708 KB Output is correct
3 Correct 2 ms 4708 KB Output is correct
4 Correct 2 ms 4708 KB Output is correct
5 Correct 2 ms 4708 KB Output is correct
6 Incorrect 2 ms 4708 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4708 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4708 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4708 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4708 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -