Submission #780033

# Submission time Handle Problem Language Result Execution time Memory
780033 2023-07-12T05:52:12 Z NothingXD Gondola (IOI14_gondola) C++17
20 / 100
13 ms 2252 KB
#include "gondola.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef complex<ld> point;

void debug_out(){cerr << endl;}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cout << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)



int valid(int n, int a[]){
	int idx = -1;
	vector<int> num;
	for (int i = 0; i < n; i++){
		if (a[i] <= n) idx = i;
		num.push_back(a[i]);
	}
	sort(all(num));
	num.resize(distance(num.begin(), unique(all(num))));
	if (num.size() < n) return 0;
	if (idx == -1) return 0;
	vector<int> v;
	idx -= (a[idx] - 1);
	for (int i = 0; i < n; i++){
		v.push_back(a[(idx+i)%n]);
	}
	for (int i = 0; i < n; i++){
		if (v[i] <= n && v[i] != i+1) return 0;
	}
	return 1;
}

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

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

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


int countReplacement(int n, int inputSeq[]){
	/*vector<int> v;
	for (int i = 0; i < n; i++){
		if (a[i] > n) v.push_back(a[i]);
	}
	sort(all(a[i]));
	int ans = 1;*/
  return -3;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:37:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |  if (num.size() < n) return 0;
      |      ~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 6 ms 976 KB Output is correct
7 Correct 11 ms 1200 KB Output is correct
8 Correct 8 ms 1612 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 12 ms 1748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 5 ms 976 KB Output is correct
7 Correct 11 ms 1232 KB Output is correct
8 Correct 8 ms 1612 KB Output is correct
9 Correct 4 ms 596 KB Output is correct
10 Correct 13 ms 1652 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 6 ms 1120 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 13 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -