Submission #576285

#TimeUsernameProblemLanguageResultExecution timeMemory
576285AdnanboiMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; #define N 100005 vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0); void init(string a, string b){ int n=a.size(); for(int i=0;i<n;i++){ a[i+1]=a[i]+(a[i]=='A' && b[i]=='C'); b[i+1]=b[i]+(a[i]=='A' && b[i]=='T'); c[i+1]=c[i]+(a[i]=='C' && b[i]=='A'); d[i+1]=d[i]+(a[i]=='C' && b[i]=='T'); e[i+1]=e[i]+(a[i]=='T' && b[i]=='A'); f[i+1]=f[i]+(a[i]=='T' && b[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); }#include <bits/stdc++.h> #include "dna.h" using namespace std; #define N 100005 vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0); void init(string a, string b){ int n=a.size(); for(int i=0;i<n;i++){ a[i+1]=a[i]+(a[i]=='A' && b[i]=='C'); b[i+1]=b[i]+(a[i]=='A' && b[i]=='T'); c[i+1]=c[i]+(a[i]=='C' && b[i]=='A'); d[i+1]=d[i]+(a[i]=='C' && b[i]=='T'); e[i+1]=e[i]+(a[i]=='T' && b[i]=='A'); f[i+1]=f[i]+(a[i]=='T' && b[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:31:2: error: stray '#' in program
   31 | }#include <bits/stdc++.h>
      |  ^
dna.cpp:31:3: error: 'include' does not name a type
   31 | }#include <bits/stdc++.h>
      |   ^~~~~~~
dna.cpp:36:13: error: redefinition of 'std::vector<int> a'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |             ^
dna.cpp:6:13: note: 'std::vector<int> a' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |             ^
dna.cpp:36:20: error: redefinition of 'std::vector<int> b'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                    ^
dna.cpp:6:20: note: 'std::vector<int> b' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                    ^
dna.cpp:36:27: error: redefinition of 'std::vector<int> c'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                           ^
dna.cpp:6:27: note: 'std::vector<int> c' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                           ^
dna.cpp:36:34: error: redefinition of 'std::vector<int> d'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                  ^
dna.cpp:6:34: note: 'std::vector<int> d' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                  ^
dna.cpp:36:41: error: redefinition of 'std::vector<int> e'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                         ^
dna.cpp:6:41: note: 'std::vector<int> e' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                         ^
dna.cpp:36:48: error: redefinition of 'std::vector<int> f'
   36 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                                ^
dna.cpp:6:48: note: 'std::vector<int> f' previously declared here
    6 | vector<int> a(N,0),b(N,0),c(N,0),d(N,0),e(N,0),f(N,0);
      |                                                ^
dna.cpp:38:6: error: redefinition of 'void init(std::string, std::string)'
   38 | void init(string a, string b){
      |      ^~~~
dna.cpp:8:6: note: 'void init(std::string, std::string)' previously defined here
    8 | void init(string a, string b){
      |      ^~~~
dna.cpp:50:5: error: redefinition of 'int get_distance(int, int)'
   50 | int get_distance(int x, int y){
      |     ^~~~~~~~~~~~
dna.cpp:20:5: note: 'int get_distance(int, int)' previously defined here
   20 | int get_distance(int x, int y){
      |     ^~~~~~~~~~~~