Submission #670557

#TimeUsernameProblemLanguageResultExecution timeMemory
670557sleepntsheepMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <stdio.h> #include <string.h> #include <string> using namespace std; #define N 100005 #define ABS(x) ((x) < 0 ? (-(x)) : (x)) char a[N], b[N]; int unlike[N]; int counta[N][3]; int countb[N][3]; void init(string a_, string b_) { strcpy(a+1, a_.c_str()); strcpy(b+1, b_.c_str()); for (int i = 1; a[i]; i++) { unlike[i] = unlike[i-1] + !!(a[i] - b[i]); for (int j = 0; j < 3; j++) { counta[i][j] = counta[i-1][j] + (j["ATC"] == a[i]); countb[i][j] = countb[i-1][j] + (j["ATC"] == b[i]); } } } int get_distance(int x, int y) { x++;y++; for (int i = 0; i < 3; i++) if (counta[y][i] - counta[x-1][i] != countb[y][i] - countb[x-1][i]) return -1; return (unlike[y] - unlike[x-1]) - 1; } int main(void) { init("ATACAT", "ACTATA"); printf("%d\n", get_distance(1, 3)); return 0; }

Compilation message (stderr)

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