Submission #1083175

# Submission time Handle Problem Language Result Execution time Memory
1083175 2024-09-02T17:14:54 Z Math4Life2020 Ancient Books (IOI17_books) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long; using pii = pair<ll,ll>;

ll minimum_walk(vector<int> p, int s) {
	ll N = p.size();
	assert(s==0);
	ll ans = 0;
	bool found[N];
	for (ll i=0;i<N;i++) {
		found[i]=0;
	}
	ll D = 0;
	for (ll i=0;i<N;i++) {
		if (!found[i]) {
			ll j = i;
			ll dmin = 1e8;
			ll L = 0;
			do {
				found[j]=1;
				dmin = min(dmin,j);
				ans += abs(p[j]-j);
				j = p[j];
				L++;
			} while (j != i);
			if (L>1) {
				D = max(D,dmin);
			}
		}
	}
	ans += 2*D;
	return ans;
}

int main() {
	vector<int> p1 = {0,1,2,3};

}

Compilation message

/usr/bin/ld: /tmp/ccCjx8RF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAg2B0F.o:books.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status