Submission #237152

# Submission time Handle Problem Language Result Execution time Memory
237152 2020-06-04T21:46:57 Z mode149256 Gondola (IOI14_gondola) C++14
10 / 100
49 ms 5624 KB
/*input

*/
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;

namespace my_template {
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<pi> vpi;
typedef vector<vpi> vpii;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef std::string str;
typedef std::vector<str> vs;

#define x first
#define y second
#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"

const ld PI = 3.14159265358979323846264338327950288419716939937510582097494L;

template<typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x + b.x, a.y + b.y); }
template<typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x - b.x, a.y - b.y); }
template<typename T>
T operator*(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.x + a.y * b.y); }
template<typename T>
T operator^(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.y - a.y * b.x); }

template<typename T>
void print(vector<T> vec, string name = "") {
	cout << name;
	for (auto u : vec)
		cout << u << ' ';
	cout << '\n';
}
}
using namespace my_template;

const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;

vi kur(250001);

int valid(int n, int inputSeq[])
{
	set<int> dabar;
	for (int i = 0; i < n; ++i)
	{
		if (dabar.find(inputSeq[i]) != dabar.end()) return 0;
		dabar.insert(inputSeq[i]);
	}

	set<int> nera;
	int did = *(--dabar.begin());

	for (int i = 0; i < n; ++i)
		kur[inputSeq[i]] = i;

	for (int i = 1; i < did; ++i)
	{
		if (dabar.find(i) == dabar.end())
			nera.insert(i);
	}

	while (*(--dabar.end()) != n) {
		int c = *(--dabar.begin());
		int n = *(--nera.begin());

		inputSeq[kur[c]] = n;
		kur[n] = kur[c];

		dabar.erase(c);
		nera.erase(n);
		dabar.insert(n);
	}

	for (int i = 0; i < n; ++i)
	{
		if (inputSeq[(kur[1] + i) % n] != 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 time Memory Grader output
1 Correct 5 ms 1280 KB Output is correct
2 Correct 5 ms 1280 KB Output is correct
3 Correct 5 ms 1280 KB Output is correct
4 Correct 5 ms 1408 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1280 KB Output is correct
2 Correct 5 ms 1280 KB Output is correct
3 Correct 5 ms 1280 KB Output is correct
4 Correct 6 ms 1280 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
6 Correct 23 ms 3200 KB Output is correct
7 Correct 18 ms 1664 KB Output is correct
8 Correct 39 ms 4984 KB Output is correct
9 Correct 15 ms 2432 KB Output is correct
10 Correct 49 ms 5624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1280 KB Output is correct
2 Correct 5 ms 1280 KB Output is correct
3 Correct 5 ms 1280 KB Output is correct
4 Correct 5 ms 1280 KB Output is correct
5 Correct 5 ms 1280 KB Output is correct
6 Correct 22 ms 3200 KB Output is correct
7 Correct 18 ms 1664 KB Output is correct
8 Correct 38 ms 5120 KB Output is correct
9 Correct 15 ms 2452 KB Output is correct
10 Correct 47 ms 5496 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Runtime error 6 ms 2432 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1408 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1280 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1280 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1280 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1280 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1284 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1280 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -