Submission #773541

# Submission time Handle Problem Language Result Execution time Memory
773541 2023-07-05T06:35:51 Z loctildore Gondola (IOI14_gondola) C++14
55 / 100
14 ms 2196 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
// trans rights
#define ll long long
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x), end(x)

int valid(int n, int inputSeq[])
{
    int tmp = -1;
    set<int> st;
    for (int i = 0; i < n; i++) {
        if (inputSeq[i] <= n) {
            int cur = (inputSeq[i] - i + n) % n;
            if (tmp == -1) tmp = cur;
            if (tmp != cur) return 0;
        }
        else {
            if (st.find(inputSeq[i]) != st.end()) return 0;
            st.insert(inputSeq[i]);
        }
    }
    return 1;
}

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

int ori[100069];
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
    int offst = 1;
    pair<int,int> maxi = {0, -1};
    for (int i = 0; i < n; i++) {
        if (gondolaSeq[i] <= n) {
            offst = gondolaSeq[i] - i;
        }
        maxi = max(maxi, {gondolaSeq[i], i});
    }
    for (int i = 0; i < n; i++) {
        ori[i] = (i + offst + n) % n;
        if (ori[i] == 0) ori[i] = n;
    }
    int l = maxi.f - n;
    for (int i = 0; i < l; i++) {
        replacementSeq[i] = -1;
    }
    for (int i = 0; i < n; i++) {
        if (gondolaSeq[i] > n && gondolaSeq[i] != maxi.f) {
            replacementSeq[gondolaSeq[i] - n - 1] = ori[i];
        }
    }
    int cur = ori[maxi.s];
    for (int i = 0; i < l; i++) {
        if (~replacementSeq[i]) continue;
        replacementSeq[i] = cur;
        cur = i + n + 1;
    }
    return l;
}

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

int countReplacement(int n, int inputSeq[])
{
    return -3;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 6 ms 532 KB Output is correct
8 Correct 6 ms 584 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 6 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 268 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 3 ms 340 KB Output is correct
7 Correct 9 ms 624 KB Output is correct
8 Correct 6 ms 592 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 6 ms 596 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 3 ms 608 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 6 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 6 ms 1352 KB Output is correct
12 Correct 7 ms 1492 KB Output is correct
13 Correct 8 ms 1452 KB Output is correct
14 Correct 6 ms 1364 KB Output is correct
15 Correct 14 ms 2196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -