답안 #1063653

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1063653 2024-08-17T22:19:20 Z Edu175 곤돌라 (IOI14_gondola) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,ioi=b;i<ioi;i++)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define imp(v) {for(auto fdgkj:v)cout<<fdgkj<<" ";cout<<"\n";}
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

void rotate(vector<ll>&a, ll x){
	rotate(a.begin(),a.begin()+x,a.end());
}

int valid(int n, int A[]){
	vector<ll>a(n);
	fore(i,0,n)a[i]=A[i]-1;
	ll done=0;
	// imp(a);
	fore(i,0,n)if(!done&&a[i]<n){
		// cout<<i<<": "<<a[i]<<"\n";
		rotate(a,(n-a[i])%n),done=1;
	}
	if(!done)return 1;
	// imp(a);
	ll flag=1;
	fore(i,0,n){
		ll fi=a[i]>=n||a[i]==i;
		flag&=fi;
		// if(!fi)cout<<i<<" "<<a[i]<<"\n";
	}
	return flag;
}
int replacement(int n, int A[], int res[]){
	vector<ll>a(n);
	fore(i,0,n)a[i]=A[i]-1;
	ll done=0;
	fore(i,0,n)if(!done&&a[i]<n){
		rotate(a,(n-a[i])%n),done=1;
	}
	if(!done)return 1;
	ll flag=1;
	fore(i,0,n){
		ll fi=a[i]>=n||a[i]==i;
		flag&=fi;
		// if(!fi)cout<<i<<" "<<a[i]<<"\n";
	}
	return flag;
}
int countReplacement(int n, int inputSeq[]){}

Compilation message

gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:53:45: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | int countReplacement(int n, int inputSeq[]){}
      |                                             ^
/usr/bin/ld: /tmp/cceJDj2G.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