Submission #955084

# Submission time Handle Problem Language Result Execution time Memory
955084 2024-03-29T10:58:05 Z 4QT0R Gondola (IOI14_gondola) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>

int valid(int n, int inputSeq[]){
	set<int> s(inputSeq,inputSeq+n);
	if (s.size()<n)return 0;
	pii mn={n+1,-1};
	for (int i = 0; i<n; i++){
		if (inputSeq[i]<mn.first)mn={inputSeq[i],i};
	}
	int cur=mn.first;
	for (int i = mn.second+1; i<n; i++){
		if (inputSeq[i]<=n && inputSeq[i]!=++cur)return 0;
	}
	for (int i = 0; ++cur<=n; i++){
		if (inputSeq[i]<=n && inputSeq[i]!=cur)return 0;
	}
	return 1;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:7:14: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |  if (s.size()<n)return 0;
      |      ~~~~~~~~^~
/usr/bin/ld: /tmp/ccGplJph.o: in function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status