Submission #788014

# Submission time Handle Problem Language Result Execution time Memory
788014 2023-07-19T16:14:43 Z jamkel Mutating DNA (IOI21_dna) C++17
0 / 100
25 ms 6220 KB
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
typedef long long ll;
vector<int>q(100000);
vector<vector<int>>p(6,vector<int>(100000));
void init(string a, string b)
{
    for(int i=0;i<a.length();i++)
    {
        if(i>0)
        {
            q[i]+=q[i-1];
            for(int w=0;w<6;w++)
            {
                p[w][i]+=p[w][i-1];
            }
        }
        if(a[i]!=b[i])
        {
            q[i]++;
            if(a[i]=='A' && b[i]=='T')
            {
                p[0][i]++;
            }
            if(a[i]=='A' && b[i]=='C')
            {
                p[1][i]++;
            }
            if(a[i]=='T' && b[i]=='C')
            {
                p[2][i]++;
            }
            if(a[i]=='T' && b[i]=='A')
            {
                p[3][i]++;
            }
            if(a[i]=='C' && b[i]=='T')
            {
                p[4][i]++;
            }
            if(a[i]=='C' && b[i]=='A')
            {
                p[5][i]++;
            }
        }
    }
}
int get_distance(int x, int y)
{
    if(x==0)
    {
        return (q[y]-min(p[0][y],p[3][y])-min(p[1][y],p[5][y])-min(p[2][y],p[4][y]));
    }
    return ((q[y]-q[x-1])-min(p[0][y]-p[0][x-1],p[3][y]-p[3][x-1])-min(p[1][y]-p[1][x-1],p[5][y]-p[5][x-1])-min(p[2][y]-p[2][x-1],p[4][y]-p[4][x-1]));
}

Compilation message

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<a.length();i++)
      |                 ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 6220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 6220 KB Output isn't correct
2 Halted 0 ms 0 KB -