Submission #780032

# Submission time Handle Problem Language Result Execution time Memory
780032 2023-07-12T05:51:29 Z NothingXD Gondola (IOI14_gondola) C++17
Compilation error
0 ms 0 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[])
{
  
}

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


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;

}

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;
      |      ~~~~~~~~~~~^~~
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
   55 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:63:7: error: 'a' was not declared in this scope
   63 |   if (a[i] > n) v.push_back(a[i]);
      |       ^
gondola.cpp:65:11: error: 'a' was not declared in this scope
   65 |  sort(all(a[i]));
      |           ^
gondola.cpp:23:16: note: in definition of macro 'all'
   23 | #define all(x) x.begin(), x.end()
      |                ^
gondola.cpp:65:13: error: 'i' was not declared in this scope
   65 |  sort(all(a[i]));
      |             ^
gondola.cpp:23:16: note: in definition of macro 'all'
   23 | #define all(x) x.begin(), x.end()
      |                ^
gondola.cpp:66:6: warning: unused variable 'ans' [-Wunused-variable]
   66 |  int ans = 1;
      |      ^~~
gondola.cpp:68:1: warning: no return statement in function returning non-void [-Wreturn-type]
   68 | }
      | ^