Submission #499679

#TimeUsernameProblemLanguageResultExecution timeMemory
499679sazid_alamDNA 돌연변이 (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" using namespace std; void init(string a, string b) { cin >> a >> b; } int get_distance(int x, int y) { string a, b; init(a, b); int p = 0, A[2] = {}, C[2] = {}, T[2] = {}; for(int i = x - 1; i < y; i++){ if(a[i] != b[i]) p++; if(a[i] == 'A') A[0]++; if(b[i] == 'A') A[1]++; if(a[i] == 'C') C[0]++; if(b[i] == 'C') C[1]++; if(a[i] == 'T') T[0]++; if(b[i] == 'T') T[1]++; } if(A[0] != A[1] || C[0] != C[1] || T[0] != T[1]) return -1; if(p % 2) return p / 2 + 1; else return p / 2; return 0; }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> a >> b;
      |   ^~~
dna.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include "dna.h"
  +++ |+#include <iostream>
    2 | using namespace std;