Submission #570588

#TimeUsernameProblemLanguageResultExecution timeMemory
570588HanksburgerMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
int sz=100005;
int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
void init(string s, string t)
{
    int len=s.length();
    for (int i=0; i<len; i++)
    {
        a[i+1]=a[i]+(s[i]=='A' && t[i]=='C');
        b[i+1]=b[i]+(s[i]=='A' && t[i]=='T');
        c[i+1]=c[i]+(s[i]=='C' && t[i]=='A');
        d[i+1]=d[i]+(s[i]=='C' && t[i]=='T');
        e[i+1]=e[i]+(s[i]=='T' && t[i]=='A');
        f[i+1]=f[i]+(s[i]=='T' && t[i]=='C');
    }
}
int get_distance(int x, int y)
{
    y++;
    int A=a[y]-a[x];
    int B=b[y]-b[x];
    int C=c[y]-c[x];
    int D=d[y]-d[x];
    int E=e[y]-e[x];
    int F=f[y]-f[x];
    if (E!=A+B-C || F!=C+D-A)
        return -1;
    return B+D+max(A, C);
}

Compilation message (stderr)

dna.cpp:5:9: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |         ^
dna.cpp:5:16: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |                ^
dna.cpp:5:23: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |                       ^
dna.cpp:5:30: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |                              ^
dna.cpp:5:37: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |                                     ^
dna.cpp:5:44: error: array bound is not an integer constant before ']' token
    5 | int a[sz], b[sz], c[sz], d[sz], e[sz], f[sz];
      |                                            ^
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:11:9: error: 'a' was not declared in this scope
   11 |         a[i+1]=a[i]+(s[i]=='A' && t[i]=='C');
      |         ^
dna.cpp:12:9: error: 'b' was not declared in this scope
   12 |         b[i+1]=b[i]+(s[i]=='A' && t[i]=='T');
      |         ^
dna.cpp:13:9: error: 'c' was not declared in this scope
   13 |         c[i+1]=c[i]+(s[i]=='C' && t[i]=='A');
      |         ^
dna.cpp:14:9: error: 'd' was not declared in this scope
   14 |         d[i+1]=d[i]+(s[i]=='C' && t[i]=='T');
      |         ^
dna.cpp:15:9: error: 'e' was not declared in this scope
   15 |         e[i+1]=e[i]+(s[i]=='T' && t[i]=='A');
      |         ^
dna.cpp:16:9: error: 'f' was not declared in this scope
   16 |         f[i+1]=f[i]+(s[i]=='T' && t[i]=='C');
      |         ^
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:22:11: error: 'a' was not declared in this scope
   22 |     int A=a[y]-a[x];
      |           ^
dna.cpp:23:11: error: 'b' was not declared in this scope
   23 |     int B=b[y]-b[x];
      |           ^
dna.cpp:24:11: error: 'c' was not declared in this scope
   24 |     int C=c[y]-c[x];
      |           ^
dna.cpp:25:11: error: 'd' was not declared in this scope
   25 |     int D=d[y]-d[x];
      |           ^
dna.cpp:26:11: error: 'e' was not declared in this scope
   26 |     int E=e[y]-e[x];
      |           ^
dna.cpp:27:11: error: 'f' was not declared in this scope
   27 |     int F=f[y]-f[x];
      |           ^