Submission #974584

# Submission time Handle Problem Language Result Execution time Memory
974584 2024-05-03T13:30:56 Z hariaakas646 Gondola (IOI14_gondola) C++14
20 / 100
24 ms 5200 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;

#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

int valid(int n, int inputSeq[])
{
  pii mi = mp(2e9, 1e9);
  seti st;
  frange(i, n) {
    mi = min(mi, mp(inputSeq[i], i));
    st.insert(inputSeq[i]);
  }
  if(st.size() != n) return 0;
  if(mi.f > n) return 1;
  int v = mi.f;
  forr(i, mi.s, n) {
    if(inputSeq[i] <= n) {
      if(inputSeq[i] != v) return 0;
    }
    v++;
  }
  forr(i, 0, mi.s) {
    if(inputSeq[i] <= n) {
      if(inputSeq[i] != v) return 0;
    }
    v++;
  }
  return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

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

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

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:36:16: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |   if(st.size() != n) return 0;
      |      ~~~~~~~~~~^~~~
# 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
# 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 0 ms 348 KB Output is correct
6 Correct 9 ms 2140 KB Output is correct
7 Correct 20 ms 3928 KB Output is correct
8 Correct 15 ms 3928 KB Output is correct
9 Correct 5 ms 1372 KB Output is correct
10 Correct 24 ms 4444 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 0 ms 344 KB Output is correct
6 Correct 8 ms 2140 KB Output is correct
7 Correct 20 ms 3568 KB Output is correct
8 Correct 15 ms 3928 KB Output is correct
9 Correct 5 ms 1368 KB Output is correct
10 Correct 18 ms 4444 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 10 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 24 ms 5200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 344 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -