Submission #853032

# Submission time Handle Problem Language Result Execution time Memory
853032 2023-09-23T10:47:42 Z aykhn Gondola (IOI14_gondola) C++14
20 / 100
25 ms 5916 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define pb push_back
#define ins insert
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define fi first
#define se second

int ok(vector<int> &v)
{
    int n = v.size();
    set<int> s;
    for (int x : v) s.ins(x);
    if (s.size() != v.size()) return 0;
    vector<int> a(n, 0);
    int anc = -1;
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] <= n) 
        {
            anc = i;
            break;
        }
    }
    if (anc == -1) return 1;
    int shift = n + v[anc] - anc - 1;
    for (int i = 0; i < n; i++) a[(i + shift + 10*n) % n] = v[i];
    for (int i = 0; i < n; i++)
    {
        if (a[i] <= n && a[i] != i + 1) return 0;
    }
    return 1;
}

int valid(int n, int in[])
{
    vector<int> v;
    for (int i = 0; i < n; i++) v.pb(in[i]);
    return ok(v);
}

int replacement(int n, int in[], int ret[])
{
    return -1;
}

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

Compilation message

gondola.cpp: In function 'int ok(std::vector<int>&)':
gondola.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 0; i < v.size(); i++)
      |                     ~~^~~~~~~~~~
# 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 600 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 1 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 8 ms 2880 KB Output is correct
7 Correct 20 ms 4564 KB Output is correct
8 Correct 15 ms 4908 KB Output is correct
9 Correct 5 ms 1884 KB Output is correct
10 Correct 19 ms 5588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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
6 Correct 8 ms 2864 KB Output is correct
7 Correct 21 ms 4408 KB Output is correct
8 Correct 15 ms 5032 KB Output is correct
9 Correct 5 ms 1884 KB Output is correct
10 Correct 18 ms 5660 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 10 ms 2516 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 25 ms 5916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Integer -1 violates the range [0, 350000]
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 344 KB Integer -1 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 -