Submission #922832

# Submission time Handle Problem Language Result Execution time Memory
922832 2024-02-06T07:35:47 Z allin27x Gondola (IOI14_gondola) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;


int valid(int n, int S[]){
	vector<int> ns;
	set<int> s; for(int i=0; i<n; i++) s.insert(S[i]); if (s.size()<n) return 0;
	int ind = -1;
	for (int i=0; i<n; i++) if (S[i] <= n) {ind = i; break;}
	if (ind == -1) return 1;
	int t = S[ind];
	for (int i=ind+1; i!=ind; i++, i%=n){
		t++; if (t==n+1) t = 1;
		if (S[i] <= n && S[i] != t) return 0;
	}
	return 1;
}

// int main(){
// 	int S[] ={1, 5, 3, 4, 2, 7, 6};
// 	cout<<valid(7,S);
// }

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:7:65: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |  set<int> s; for(int i=0; i<n; i++) s.insert(S[i]); if (s.size()<n) return 0;
      |                                                         ~~~~~~~~^~
/usr/bin/ld: /tmp/ccSJrKuh.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