제출 #371042

#제출 시각아이디문제언어결과실행 시간메모리
371042peijar곤돌라 (IOI14_gondola)C++17
10 / 100
14 ms2424 KiB
#include "gondola.h"
#include <bits/stdc++.h>
#define SZ(v) ((int)(v).size())
using namespace std;

using ll = long long;

int valid(int n, int inputSeq[])
{
	vector<int> order;
	for (int i(0); i < n; ++i)
	{
		int cur = inputSeq[i];
		if (cur <= n)
			order.push_back(cur);
	}
	if (SZ(order) == 0) return 1;
	int posInv(0);
	while (posInv + 1 < SZ(order) and order[posInv] < order[posInv+1])
		posInv++;
	if (posInv + 1 == SZ(order))
		return 1;
	vector<int> finalOrder;
	for (int i(posInv+1); i < SZ(order); ++i)
		finalOrder.push_back(order[i]);
	for (int i(0); i <= posInv; ++i)
		finalOrder.push_back(order[i]);
	order = move(finalOrder);
	for (int i(0); i+1 < SZ(order); ++i)
		if (order[i] >= order[i+1])
			return 0;
  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...