Submission #1032862

# Submission time Handle Problem Language Result Execution time Memory
1032862 2024-07-24T10:04:42 Z c2zi6 Gondola (IOI14_gondola) C++14
25 / 100
21 ms 5072 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "gondola.h"

int valid(int n, int inputSeq[]) {
    VI a;
    rep(i, n) {
        if (inputSeq[i] <= n) {
            int start = i - inputSeq[i] + 1;
            if (start < n) start += n;
            replr(i, start, start+n-1) a.pb(inputSeq[i%n]);
            break;
        }
    }
    if (a.size() == 0) {
        rep(i, n) a.pb(inputSeq[i]);
    }
    set<int> st;
    for (int x : a) st.insert(x);
    if (st.size() != a.size()) return false;
    rep(i, n) {
        if (a[i] <= n) {
            if (a[i] != i+1) return false;
        }
    }
    return true;
}

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

int replacement(int n, int inputSeq[], int replacementSeq[]) {
    VI a;
    rep(i, n) {
        if (inputSeq[i] <= n) {
            int start = i - inputSeq[i] + 1;
            if (start < n) start += n;
            replr(i, start, start+n-1) a.pb(inputSeq[i%n]);
            break;
        }
    }
    if (a.size() == 0) {
        rep(i, n) a.pb(inputSeq[i]);
    }
    for (int& x : a) x--;
    int mx = 0;
    VI ka(250'000);
    rep(i, n) {
        setmax(mx, a[i]);
        ka[a[i]] = true;
    }
    VI ans;
    rep(i, mx) if (!ka[i]) ans.pb(i);

    rep(i, ans.size()) replacementSeq[i] = ans[i]+1;
    return ans.size();
}

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

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









# 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 1 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 348 KB Output is correct
6 Correct 7 ms 2372 KB Output is correct
7 Correct 21 ms 4052 KB Output is correct
8 Correct 13 ms 4304 KB Output is correct
9 Correct 4 ms 1624 KB Output is correct
10 Correct 15 ms 4960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 348 KB Output is correct
6 Correct 8 ms 2372 KB Output is correct
7 Correct 18 ms 4048 KB Output is correct
8 Correct 12 ms 4312 KB Output is correct
9 Correct 4 ms 1628 KB Output is correct
10 Correct 16 ms 4820 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 8 ms 2264 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 21 ms 5072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1372 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1376 KB Output is correct
4 Correct 1 ms 1380 KB Output is correct
5 Correct 1 ms 1384 KB Output is correct
6 Correct 1 ms 1376 KB Output is correct
7 Incorrect 1 ms 1380 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1412 KB Output is correct
4 Correct 1 ms 1368 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Incorrect 1 ms 1372 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 352 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -