답안 #68797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68797 2018-08-18T13:44:31 Z Vahan 곤돌라 (IOI14_gondola) C++17
10 / 100
19 ms 5600 KB
#include "gondola.h"
#include<vector>
using namespace std;

int valid(int n, int inputSeq[])
{
    int x[200000];
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        if(inputSeq[i]<=n)
        {
            v.push_back(inputSeq[i]);
            x[inputSeq[i]]=i;
        }
    }
    int t=0;
    for(int i=1;i<v.size();i++)
    {
        if(v[i-1]>v[i])
            t++;
    }
    if(t>=2)
        return 0;
    if(t==1 && v.back()>v[0])
        return 0;
    t=0;
    for(int i=1;i<v.size();i++)
    {
        if(v[i-1]<v[i])
        {
            if(v[i]-v[i-1]!=x[v[i]]-x[v[i-1]])
            {
                t=1;
                break;
            }
        }
        if(v[i-1]>v[i])
        {
            if(n-(v[i-1]-v[i])!=x[v[i]]-x[v[i-1]])
            {
                t=1;
                break;
            }
        }
    }
    if(t==1)
        return 0;
    return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

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

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

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<v.size();i++)
                 ~^~~~~~~~~
gondola.cpp:28:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<v.size();i++)
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 424 KB Output is correct
5 Correct 2 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 548 KB Output is correct
2 Correct 2 ms 780 KB Output is correct
3 Correct 2 ms 780 KB Output is correct
4 Correct 3 ms 780 KB Output is correct
5 Correct 2 ms 828 KB Output is correct
6 Correct 9 ms 1860 KB Output is correct
7 Correct 19 ms 2956 KB Output is correct
8 Correct 13 ms 3212 KB Output is correct
9 Correct 6 ms 3212 KB Output is correct
10 Correct 15 ms 3880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3880 KB Output is correct
2 Correct 2 ms 3880 KB Output is correct
3 Correct 3 ms 3880 KB Output is correct
4 Correct 3 ms 3880 KB Output is correct
5 Correct 2 ms 3880 KB Output is correct
6 Correct 8 ms 3880 KB Output is correct
7 Correct 17 ms 4684 KB Output is correct
8 Correct 16 ms 4940 KB Output is correct
9 Correct 5 ms 4940 KB Output is correct
10 Correct 14 ms 5600 KB Output is correct
11 Incorrect 5 ms 5600 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5600 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 5600 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5600 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 5600 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5600 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 5600 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5600 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -