답안 #953606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
953606 2024-03-26T10:14:08 Z emad234 곤돌라 (IOI14_gondola) C++17
20 / 100
7 ms 616 KB
#include "gondola.h"
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair<ll, ll>
const ll mod = 1e9 + 7;
const ll mxN = 1e6 + 5;
using namespace std;
int valid(int n, int inputSeq[])
{
  vector<bool> vis(250000 + 3);
  int st = 0;
  int val = 1;
  for (int i = 0; i < n; i++)
  {
    if (vis[inputSeq[i]])
      return 0;
    vis[inputSeq[i]] = 1;
    if (inputSeq[i] <= n)
    {
      st = i;
      val = inputSeq[i];
    }
  }
  int og = st;
  while (1)
  {
    st++;
    val++;
    if (st >= n)
      st = 0;
    if (val > n)
      val = 1;
    if (st == og)
      break;
    if (inputSeq[st] != val && inputSeq[st] <= n)
      return 0;
  }
  return 1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  set<int> s;
  int mx = 0;
  for (int i = 0; i < n; i++)
    mx = max(mx, gondolaSeq[i]);
  for (int i = 1; i <= mx; i++)
    s.insert(i);
  for (int i = 0; i < n; i++)
    s.erase(gondolaSeq[i]);
  int id = 0;
  while (s.size())
  {
    replacementSeq[id] = *s.begin();
    s.erase(s.begin());
    id++;
  }
  return id + 1;
}

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

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 6 ms 616 KB Output is correct
8 Correct 6 ms 604 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 7 ms 604 KB Output is correct
# 결과 실행 시간 메모리 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 3 ms 600 KB Output is correct
7 Correct 7 ms 604 KB Output is correct
8 Correct 6 ms 604 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 6 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 7 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer 0 violates the range [1, 77]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer 0 violates the range [1, 77]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Integer 0 violates the range [1, 77]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 544 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -