Submission #278097

# Submission time Handle Problem Language Result Execution time Memory
278097 2020-08-21T10:29:45 Z shinjan Gondola (IOI14_gondola) C++14
20 / 100
13 ms 1280 KB
#include <iostream>
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
set<int> gond;
int valid(int n,int seq[])
{
    int prvi=-1;
    for(int i=0;i<n;i++)
    {
        if(seq[i]<=n)
        {
            prvi=i;
            break;
        }
    }
    if(prvi==-1)
    {
        for(int i=0;i<n;i++)
        {
            if(gond.find(seq[i])!=gond.end())
            {
                return 0;
            }
            gond.insert(seq[i]);
        }
        return 1;
    }
    int tren=seq[prvi];
    for(int i=prvi+1;i<n;i++)
    {
        if(tren==n)
        {
            if(seq[i]!=1)
            {
                if(seq[i]<=n)
                {
                    return 0;
                }
                if(gond.find(seq[i])!=gond.end())
                {
                    return 0;
                }
                gond.insert(seq[i]);
            }
            tren=1;
        }
        else if(seq[i]!=tren+1)
        {
            if(seq[i]<=n)
            {
                return 0;
            }
            if(gond.find(seq[i])!=gond.end())
            {
                return 0;
            }
            gond.insert(seq[i]);
            tren=tren+1;
        }
        else{
            tren=tren+1;
        }
    }
    for(int i=0;i<=prvi;i++)
    {
        if(tren==n)
        {
            if(seq[i]!=1)
            {
                if(seq[i]<=n)
                {
                    return 0;
                }
                if(gond.find(seq[i])!=gond.end())
                {
                    return 0;
                }
                gond.insert(seq[i]);
            }
            tren=1;
        }
        else if(seq[i]!=tren+1)
        {
            if(seq[i]<=n)
            {
                return 0;
            }
            if(gond.find(seq[i])!=gond.end())
            {
                return 0;
            }
            gond.insert(seq[i]);
            tren=tren+1;
        }
        else{
            tren=tren+1;
        }
    }
    return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
    return 0;
}
int countReplacement(int n, int inputSeq[])
{
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 12 ms 1152 KB Output is correct
8 Correct 10 ms 1024 KB Output is correct
9 Correct 4 ms 512 KB Output is correct
10 Correct 12 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 7 ms 640 KB Output is correct
7 Correct 11 ms 1152 KB Output is correct
8 Correct 9 ms 1024 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 10 ms 1280 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 7 ms 640 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 13 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -