Submission #1017615

# Submission time Handle Problem Language Result Execution time Memory
1017615 2024-07-09T09:10:15 Z serkanrashid Gondola (IOI14_gondola) C++14
20 / 100
14 ms 5740 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5+5;

int n,a[maxn];

bool check_valid()
{
    unordered_set<int>used;
    int st = -1;

    for(int i = 0; i < n; i++)
    {
        if(used.find(a[i])!=used.end()) return false;
        used.insert(a[i]);
        if(1<=a[i] && a[i] <= n) st = i;
    }
    if(st==-1) return true;

    bool f = true;
    int last = a[st];
    int i = (st+1)%n;

    while(i!=st)
    {
        last++;
        if(last>n) last = 1;
        if(1<=a[i] && a[i]<=n)
        {
            if(last!=a[i]) return false;
        }
        i = (i+1)%n;
    }
    return true;
}

int valid(int N, int inputSeq[])
{
    n = N;
    for(int i = 0; i < n; i++) a[i] = inputSeq[i];
    return check_valid();
}

int replacement(int N, int gondolaSeq[], int replacementSeq[])
{
    n = N;
}

int countReplacement(int N, int inputSeq[])
{
    n = N;
    for(int i = 0; i < n; i++) a[i] = inputSeq[i];
    if(!check_valid()) return 0;
    ///OSHTE


}

Compilation message

gondola.cpp: In function 'bool check_valid()':
gondola.cpp:23:10: warning: unused variable 'f' [-Wunused-variable]
   23 |     bool f = true;
      |          ^
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:50:1: warning: no return statement in function returning non-void [-Wreturn-type]
   50 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 4 ms 2232 KB Output is correct
7 Correct 9 ms 1116 KB Output is correct
8 Correct 8 ms 3748 KB Output is correct
9 Correct 3 ms 1628 KB Output is correct
10 Correct 10 ms 4204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 5 ms 2232 KB Output is correct
7 Correct 6 ms 1116 KB Output is correct
8 Correct 8 ms 3692 KB Output is correct
9 Correct 3 ms 1628 KB Output is correct
10 Correct 9 ms 4240 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 6 ms 1976 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 14 ms 5740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -