Submission #1255795

#TimeUsernameProblemLanguageResultExecution timeMemory
1255795robijoyMutating DNA (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
// #include "dna.h"
using namespace std;

string A,B;
int n;

void init(std::string a, std::string b) {
	A = a;
	B = b;
	n = a.size();
}

int get_distance(int x, int y) {
	if(x == y) {
		if(A[x]!=B[y]) {
			return -1;
		}else {
			return 0;
		}
	}
	int ans = -1;

	string ro = A.substr(x,y-x+1);
	string ra = B.substr(x,y-x+1);
	string roo = ro;
	string raa = ra;
	sort(roo.begin(), roo.end());
	sort(raa.begin(), raa.end());
	
	if(roo == raa) { 
		if(ro == ra) {
			ans = 0;
		}else{
			ans = 1;
		}
	}
	return ans;
}

int main() {
	init("ATATAT","ATTATA");
	cout<<get_distance(0,1)<<endl;
}

Compilation message (stderr)

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