답안 #46765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46765 2018-04-23T04:12:18 Z RayaBurong25_1 곤돌라 (IOI14_gondola) C++17
20 / 100
14 ms 1148 KB
#include "gondola.h"
#include <vector>
#include <algorithm>
int Vis[250005];
int valid(int n, int inputSeq[])
{
    int i, r = -1;
    for (i = 0; i < n; i++)
    {
        if (Vis[inputSeq[i]])
            return 0;
        Vis[inputSeq[i]] = 1;
        if (inputSeq[i] <= n)
        {
            if (r == -1)
                r = (inputSeq[i] + n - (i + 1))%n;
            else if ((inputSeq[i] + n - (i + 1))%n != r)
                return 0;
        }
    }
    return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
    int i, r = 0;
    for (i = 0; i < n; i++)
    {
        if (gondolaSeq[i] <= n)
        {
            if (r == -1)
            {
                r = (gondolaSeq[i] + n - (i + 1))%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)%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];
        gondolaSeq[V[j].second] = i;
        if (V[j].first == i)
            j++;
        r++;
    }
    return r;
}

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

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 2 ms 424 KB Output is correct
5 Correct 2 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 2 ms 576 KB Output is correct
5 Correct 2 ms 576 KB Output is correct
6 Correct 6 ms 876 KB Output is correct
7 Correct 13 ms 876 KB Output is correct
8 Correct 11 ms 1132 KB Output is correct
9 Correct 5 ms 1132 KB Output is correct
10 Correct 12 ms 1148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1148 KB Output is correct
2 Correct 2 ms 1148 KB Output is correct
3 Correct 2 ms 1148 KB Output is correct
4 Correct 1 ms 1148 KB Output is correct
5 Correct 2 ms 1148 KB Output is correct
6 Correct 6 ms 1148 KB Output is correct
7 Correct 13 ms 1148 KB Output is correct
8 Correct 11 ms 1148 KB Output is correct
9 Correct 5 ms 1148 KB Output is correct
10 Correct 12 ms 1148 KB Output is correct
11 Correct 2 ms 1148 KB Output is correct
12 Correct 2 ms 1148 KB Output is correct
13 Correct 9 ms 1148 KB Output is correct
14 Correct 2 ms 1148 KB Output is correct
15 Correct 14 ms 1148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1148 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -