제출 #445577

#제출 시각아이디문제언어결과실행 시간메모리
445577hgmhcDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define REP(i,a,b) for (auto i = (a); i <= (b); ++i) #define PER(i,a,b) for (auto i = (b); i >= (a); --i) #define log2(x) (31-__builtin_clz(x)) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define SZ(x) (int)(x).size() #define PB push_back #define FI first #define SE second #define mup(x,y) x = min(x,y) #define Mup(x,y) x = max(x,y) #define debug(x) cout << #x << " is " << x << el #define el '\n' using namespace std; using ll = long long; using ii = pair<int,int>; using iii = tuple<int,int,int>; void solution(); int main() {ios::sync_with_stdio(0); cin.tie(0); solution();} const int N = 100003; int n, q; string s, t; int solve(int l, int r) { vector<int> a1, t1, c1; vector<int> a2, t2, c2; REP(i,l,r) { if (s[i] == 'A') a1.push_back(i); else if (s[i] == 'T') t1.push_back(i); else c1.push_back(i); if (t[i] == 'A') a2.push_back(i); else if (t[i] == 'T') t2.push_back(i); else c2.push_back(i); } int x = 0; if (SZ(a1) != SZ(a2)) return -1; if (SZ(t1) != SZ(t2)) return -1; if (SZ(c1) != SZ(c2)) return -1; REP(i,0,SZ(a1)-1) { x += abs(a1[i]-a2[i]); } REP(i,0,SZ(t1)-1) { x += abs(t1[i]-t2[i]); } REP(i,0,SZ(c1)-1) { x += abs(c1[i]-c2[i]); } return x/2; } void input() { cin >> n >> q; cin >> s >> t; } void solution() { input(); while (q--) { int l, r; cin >> l >> r; cout << solve(l,r) << el; } }

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

/usr/bin/ld: /tmp/cc6RUSam.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMF7QGm.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc6RUSam.o: in function `main':
grader.cpp:(.text.startup+0x366): undefined reference to `init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status