Submission #1106616

#TimeUsernameProblemLanguageResultExecution timeMemory
1106616kheiraMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define KHEIRA ios_base::sync_with_stdio(false); #define WAH cin.tie(NULL); #include "dna.h" vector<int> A_a , C_a , T_a ; vector<int> A_b , C_b , T_b; void init(string a, astring b) { int n = a.size(); A_a = C_a = T_a = vector<int>(n+1 , 0) ; A_b = C_b = T_b = vector<int>(n+1 , 0) ; for(int i = 1 ; i <= n ; ++i){ A_a[i] = A_a[i - 1] + (a[i - 1] == 'A'); C_a[i] = C_a[i - 1] + (a[i - 1] == 'C'); T_a[i] = T_a[i - 1] + (a[i - 1] == 'T'); A_b[i] = A_b[i - 1] + (b[i - 1] == 'A'); C_b[i] = C_b[i - 1] + (b[i - 1] == 'C'); T_b[i] = T_b[i - 1] + (b[i - 1] == 'T'); } } int get_distance(int x, int y) { int a_count_A = A_a[y + 1] - A_a[x]; int a_count_C = C_a[y + 1] - C_a[x]; int a_count_T = T_a[y + 1] - T_a[x]; int b_count_A = A_b[y + 1] - A_b[x]; int b_count_C = C_b[y + 1] - C_b[x]; int b_count_T = T_b[y + 1] - T_b[x]; if (a_count_A != b_count_A || a_count_C != b_count_C || a_count_T != b_count_T) { return -1; } int makanch_AC = 0, makanch_AT = 0, makanch_CT = 0; return makanch_AC + makanch_AT + makanch_CT; return 0; }

Compilation message (stderr)

dna.cpp:8:21: error: 'astring' has not been declared
    8 | void init(string a, astring b) {
      |                     ^~~~~~~
dna.cpp: In function 'void init(std::string, int)':
dna.cpp:17:33: error: invalid types 'int[int]' for array subscript
   17 |         A_b[i] = A_b[i - 1] + (b[i - 1] == 'A');
      |                                 ^
dna.cpp:18:33: error: invalid types 'int[int]' for array subscript
   18 |         C_b[i] = C_b[i - 1] + (b[i - 1] == 'C');
      |                                 ^
dna.cpp:19:33: error: invalid types 'int[int]' for array subscript
   19 |         T_b[i] = T_b[i - 1] + (b[i - 1] == 'T');
      |                                 ^