제출 #624955

#제출 시각아이디문제언어결과실행 시간메모리
624955iomoon191DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "dna.h" #include <bits/stdc++.h> using ll = long long; #define int ll using namespace std; #define sz(x) (int)(x).size() #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, l, r) for(int i = l; i >= r; i--) #define fi first #define se second #define mod 998244353 #define db(x) cerr << __LINE__ << " " << #x << " " << x << "\n" using vi = vector<int>; using pi = pair<int, int>; const ll N = 100005; const ll inf = 1e18; int cnt[N][3], sum[N][3][3]; void init(string a, string b){ int s = sz(a); auto type = [&](char c){ if(c == 'A') return 0; if(c == 'T') return 1; if(c == 'C') return 2; }; foru(i, 1, s){ foru(j, 0, 2){ foru(k, 0, 2){ sum[i][j][k] = sum[i - 1][j][k]; } cnt[i][j] = cnt[i - 1][j]; } sum[i][type(a[i - 1])][type(b[i - 1])]++; cnt[i][type(a[i - 1])]++; cnt[i][type(b[i - 1])]--; } } int get_distance(int x, int y){ int c[3][3] = {{0}}; foru(i, 0, 2){ foru(j, 0, 2){ c[i][j] = sum[y + 1][i][j] - sum[x][i][j]; } } if(cnt[y + 1][0] != cnt[x][0] or cnt[y + 1][1] != cnt[x][1] or cnt[y + 1][2] != cnt[x][2]) return -1; int z, ret = 0; z = min(c[1][0], c[0][1]); c[1][0] -= z; c[0][1] -= z; ret += z; z = min(c[1][2], c[2][1]); c[1][2] -= z; c[2][1] -= z; ret += z; z = min(c[2][0], c[0][2]); c[2][0] -= z; c[0][2] -= z; ret += z; return ret + 2 * (c[0][1] + c[1][0]); }

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

dna.cpp: In lambda function:
dna.cpp:32:2: warning: control reaches end of non-void function [-Wreturn-type]
   32 |  };
      |  ^
/usr/bin/ld: /tmp/cclT3MeD.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status