제출 #1196351

#제출 시각아이디문제언어결과실행 시간메모리
1196351dosts곤돌라 (IOI14_gondola)C++20
10 / 100
5 ms1092 KiB
#include "gondola.h"
#include <bits/stdc++.h>
#pragma GCC target("lzcnt,popcnt")
#pragma GCC optimize("O3,unroll-loops")
//#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define sp << " " << 
using namespace std;


int valid(int n, int inputSeq[])
{
  vi pos(n+1,-1);
  for (int i=0;i<n;i++) {
    if (inputSeq[i] <= n) {
      if (pos[inputSeq[i]] != -1) return 0;
      pos[inputSeq[i]] = i;
    }
  }
  int frst = -1;
  int lst = -1,lsty = -1;
  for (int j = 1;j<=n;j++) {
    if (pos[j] == -1) continue;
    if (frst == -1) frst = pos[j];
    pos[j] = (pos[j]-frst+n)%n;
    if (lst != -1 && pos[j] <= lst) return 0;
    if (lst != -1 && pos[j]-lst != j-lsty) return 0;
    lst = pos[j];
    lsty = j;
  }
  return 1;
}

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

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

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

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...