제출 #437498

#제출 시각아이디문제언어결과실행 시간메모리
437498grtDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define PB push_back #define ST first #define ND second #define _ ios_base::sync_with_stdio(0); cin.tie(0); //mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; const int nax = 100 * 1000 + 10; int cnt[nax][10]; int cur[10]; map<char,int>odp; void init(string a, string b) { odp['A'] = 0; odp['T'] = 1; odp['C'] = 2; for(int i = 1; i <= n; ++i) { for(int j = 0; j < 9; ++j) { cnt[i][j] = cnt[i - 1][j]; } int x = odp[a[i - 1]] * 3 + odp[b[i - 1]]; cnt[i][x]++; } } int get_distance(int x, int y) { y++; for(int i = 0; i < 9; ++i) { cur[i] = cnt[y][i] - cnt[x][i]; } if(cur[0] + cur[3] + cur[6] != cur[0] + cur[1] + cur[2]) return -1; if(cur[1] + cur[4] + cur[7] != cur[3] + cur[4] + cur[5]) return -1; if(cur[2] + cur[5] + cur[8] != cur[6] + cur[7] + cur[8]) return -1; int ans = 0; ans = max(cur[1], cur[3]) + max(cur[2], cur[6]) + max(cur[5], cur[7]); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:23:22: error: 'n' was not declared in this scope
   23 |  for(int i = 1; i <= n; ++i) {
      |                      ^