Submission #68802

# Submission time Handle Problem Language Result Execution time Memory
68802 2018-08-18T13:54:31 Z Vahan Gondola (IOI14_gondola) C++17
0 / 100
2 ms 620 KB
#include "gondola.h"
#include<vector>
#include<algorithm>
using namespace std;
int x[200000],xx[200000];
int valid(int n, int inputSeq[])
{
    vector<int> v;
    for(int i=0;i<n;i++)
        xx[i]=inputSeq[i];
    sort(xx,xx+n);
    int t=0;
    for(int i=1;i<n;i++)
        if(xx[i]==xx[i-1])
        {
            t=1;
            break;
        }
    //if(t==1)
      //  return 0;
    for(int i=1;i<=n;i++)
    {
        if(inputSeq[i]<=n)
        {
            v.push_back(inputSeq[i]);
            x[inputSeq[i]]=i;
        }
    }
    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;
            }
        }
        else 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:30:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<v.size();i++)
                 ~^~~~~~~~~
gondola.cpp:40:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<v.size();i++)
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 620 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 620 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 620 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 620 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -