Submission #576279

#TimeUsernameProblemLanguageResultExecution timeMemory
576279AdnanboiDNA 돌연변이 (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "dna.h"
using namespace std;

#define N 100005

ios_base::sync_with_stdio(false);
cin.tie(0);

vector<int> a(N),b(N),c(N),d(N),e(N),f(N);

void init(string a, string b){
    int n=a.size();
    for(int i=0;i<n;i++){
        else if(a[i]=='A' && b[i]=='T') b[i+1]=b[i]+1;
        else if(a[i]=='T' && b[i]=='A') e[i+1]=e[i]+1;
    }
}

int get_distance(int x, int y){
    y++;
    int B=b[y]-b[x];
    int E=e[y]-e[x];
    if (E!=B)
        return -1;
    return B+E;
}

Compilation message (stderr)

dna.cpp:7:26: error: expected constructor, destructor, or type conversion before '(' token
    7 | ios_base::sync_with_stdio(false);
      |                          ^
dna.cpp:8:1: error: 'cin' does not name a type; did you mean 'sin'?
    8 | cin.tie(0);
      | ^~~
      | sin
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:15:9: error: 'else' without a previous 'if'
   15 |         else if(a[i]=='A' && b[i]=='T') b[i+1]=b[i]+1;
      |         ^~~~