Submission #716419

#TimeUsernameProblemLanguageResultExecution timeMemory
716419kidlinMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
const int val = 1e8+5;
string s,t;
int T0[val],C0[val],A0[val],T1[val],A1[val],C1[val], res[val];
void init(string a,string b){
    s='#' + a,t= '#' + b;
    for(int i=1;i<s.size();i++)
    {
            if(s[i]=='T') T0[i]++;
            T0[i]+=T0[i-1];

            if(s[i]=='C') C0[i]++;
            C0[i]+=C0[i-1];

            if(s[i]=='A') A0[i]++;
            A0[i]+=A0[i-1];

            if(t[i]=='T') T1[i]++;
            T1[i]+=T1[i-1];

            if(t[i]=='C') C1[i]++;
            C1[i]+=C1[i-1];

            if(t[i]=='A') A1[i]++;
            A1[i]+=A1[i-1];

            if(t[i] != s[i]) res[i] ++;
            res[i] += res[i-1];
    }
}
int get_distance(int x, int y)
{
        x ++, y ++;
        int f = T0[y]-T0[x-1];
        int f1 = T1[y]-T1[x-1];
        int g = C0[y]-C0[x-1];
        int g1 = C1[y]-C1[x-1];
        int d = A0[y]-A0[x-1];
        int d1 = A1[y]-A1[x-1];
        if(f!=f1 || g!=g1 || d!=d1) return -1;
        return (res[y]-res[x-1]+1)/2;
}

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=1;i<s.size();i++)
      |                 ~^~~~~~~~~
/tmp/ccCtBF2N.o: in function `get_distance(int, int)':
dna.cpp:(.text+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `T0' defined in .bss section in /tmp/ccCtBF2N.o
/tmp/ccCtBF2N.o: in function `init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
dna.cpp:(.text+0xde): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x108): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x10f): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x11d): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `t[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x173): relocation truncated to fit: R_X86_64_PC32 against symbol `t[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x188): relocation truncated to fit: R_X86_64_PC32 against symbol `t[abi:cxx11]' defined in .bss section in /tmp/ccCtBF2N.o
dna.cpp:(.text+0x18f): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status