Submission #164984

# Submission time Handle Problem Language Result Execution time Memory
164984 2019-11-24T15:35:20 Z kostia244 Gondola (IOI14_gondola) C++17
Compilation error
0 ms 0 KB
#include "gondola.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
int valid(int n, int a[])
{
	vi v, b;
	int x = n+1;
	for(int i = 0; i < n; i++) {
		if(a[i]<=n)
			v.pb(a[i]), x = min(x, a[i]);
		else
			b.pb(a[i]);
	}
	sort(all(b));
	for(int i =1;i<b.size();i++)if(b[i]==b[i-1]) return 0;
	if(v.size()<2) return 1;
	int i = 0;
	while(v[i] != x) v.pb(v[i++]);

	for(++i; i < v.size(); i++) {
		if(v[i]<=v[i-1]) return 0;
	}
	return 1;
}

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

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

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

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:17:7: error: 'all' was not declared in this scope
  sort(all(b));
       ^~~
gondola.cpp:17:7: note: suggested alternative: 'll'
  sort(all(b));
       ^~~
       ll
gondola.cpp:18:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i =1;i<b.size();i++)if(b[i]==b[i-1]) return 0;
               ~^~~~~~~~~
gondola.cpp:23:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(++i; i < v.size(); i++) {
           ~~^~~~~~~~~~