Submission #598120

# Submission time Handle Problem Language Result Execution time Memory
598120 2022-07-17T16:25:49 Z enerelt14 Gondola (IOI14_gondola) C++14
35 / 100
19 ms 3092 KB
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;

int valid(int n, int inputSeq[]){
    int k=n+1, s;
    for (int i=0;i<n;i++){
        if (i>n)continue;
        s=inputSeq[i]-i;
        if (k==n+1)k=s;
        if (k!=s && min(k, s)+n!=max(k, s))return 0;
    }
    return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
    int mx=0, k=0;
    for (int i=0;i<n;i++)mx=max(mx, gondolaSeq[i]);
    bool vis[mx+1]={0};
    int pos[mx+1], a[n];
    for (int i=0;i<n;i++){
        vis[gondolaSeq[i]]=1;
        pos[gondolaSeq[i]]=i;
        if (gondolaSeq[i]<=n)k=gondolaSeq[i]-i;
    }
    for (int i=0;i<n;i++){
        a[i]=k+i;
        if (a[i]<=0)a[i]+=n;
    }
    for (int i=n+1;i<=mx;i++){
        if (vis[i]){
            replacementSeq[i-n-1]=a[pos[i]];
            a[pos[i]]=i;
            continue;
        }
        replacementSeq[i-n-1]=a[pos[mx]];
        a[pos[mx]]=i;
    }
    return mx-n;
}

int countReplacement(int n, int inputSeq[]){
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 404 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 4 ms 568 KB Output is correct
7 Correct 9 ms 1088 KB Output is correct
8 Correct 8 ms 980 KB Output is correct
9 Correct 3 ms 448 KB Output is correct
10 Correct 8 ms 1012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 5 ms 596 KB Output is correct
7 Correct 10 ms 1092 KB Output is correct
8 Correct 7 ms 1008 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 8 ms 1008 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 4 ms 572 KB Output is correct
14 Correct 1 ms 312 KB Output is correct
15 Correct 14 ms 1136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 11 ms 1748 KB Output is correct
12 Correct 9 ms 1864 KB Output is correct
13 Correct 11 ms 2004 KB Output is correct
14 Correct 8 ms 1632 KB Output is correct
15 Incorrect 19 ms 3092 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -