Submission #1065661

# Submission time Handle Problem Language Result Execution time Memory
1065661 2024-08-19T10:35:55 Z andrei_iorgulescu Gondola (IOI14_gondola) C++14
45 / 100
22 ms 11344 KB
#include <bits/stdc++.h>
#include "gondola.h"
#warning That's not FB, that's my FB

using namespace std;

int valid(int n, int inputSeq[])
{
    for (int i = 0; i < n; i++)
        inputSeq[i]--;
    int shift = -1;
    for (int i = 0; i < n; i++)
    {
        if (inputSeq[i] < n)
        {
            int cur_shift = (n + inputSeq[i] - i) % n;
            if (shift == -1)
                shift = cur_shift;
            else if (shift != cur_shift)
                return 0;
        }
    }
    return 1;
}

int replacement(int n, int gondolaSequence[], int replacementSeq[])
{
    for (int i = 0; i < n; i++)
        gondolaSequence[i]--;
    int mxe = 0;
    for (int i = 0; i < n; i++)
        mxe = max(mxe, gondolaSequence[i]);
    vector<int> pos(mxe + 5), ans(mxe + 5);
    for (int i = 0; i <= mxe; i++)
        pos[i] = -1;
    for (int i = 0; i < n; i++)
        pos[gondolaSequence[i]] = i;
    set<int> spatii;
    for (int i = mxe; i >= 0; i--)
    {
        if (pos[i] == -1)
            ans[i] = *spatii.begin();
        else
            ans[i] = pos[i], spatii.insert(pos[i]);
    }
    int shift = 0;
    for (int i = 0; i < n; i++)
    {
        if (gondolaSequence[i] < n)
        {
            shift = (n + gondolaSequence[i] - i) % n;
        }
    }
    vector<vector<int>> lol(n);
    for (int i = 0; i < n; i++)
        lol[i].push_back((i + shift) % n);
    for (int i = n; i <= mxe; i++)
        lol[ans[i]].push_back(i);
    vector<int> cur(n);
    for (int i = n; i <= mxe; i++)
    {
        replacementSeq[i - n] = lol[ans[i]][cur[ans[i]]];
        cur[ans[i]]++;
    }
    for (int i = 0; i <= mxe - n; i++)
        replacementSeq[i]++;
    return mxe - n + 1;
}

int countReplacement(int n, int inputSeq[])
{
    return -1;
}

Compilation message

gondola.cpp:3:2: warning: #warning That's not FB, that's my FB [-Wcpp]
    3 | #warning That's not FB, that's my FB
      |  ^~~~~~~
# 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 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 1 ms 344 KB Output is correct
6 Correct 5 ms 708 KB Output is correct
7 Correct 8 ms 1224 KB Output is correct
8 Correct 6 ms 1096 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 6 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 444 KB Output is correct
6 Correct 5 ms 600 KB Output is correct
7 Correct 9 ms 1220 KB Output is correct
8 Correct 6 ms 1116 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 6 ms 1088 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 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 1 ms 444 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 20 ms 9992 KB Output is correct
12 Correct 22 ms 11344 KB Output is correct
13 Correct 21 ms 5848 KB Output is correct
14 Correct 21 ms 10056 KB Output is correct
15 Correct 20 ms 5068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -