제출 #1069928

#제출 시각아이디문제언어결과실행 시간메모리
1069928erdemfurkanDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; string A; string B; int prea[3][100007]; int preb[3][100007]; int prec[100007]; void init(string a, string b) { A = a; B = b; } int get_distance(int x, int y) { x++; y++; int i = prea[0][y] - prea[0][x-1]; int j = prea[1][y] - prea[1][x-1]; int k = prea[2][y] - prea[2][x-1]; int ii = preb[0][y] - preb[0][x-1]; int jj = preb[1][y] - preb[1][x-1]; int kk = preb[2][y] - preb[2][x-1]; if(ii != i || jj != j || kk != k) { return -1; } int l = y-x+1; return (l - (prec[y] - prec[x-1] + 1))/2; } int main() { for(int i = 0; i < A.length(); i++) { prea[0][i+1] = prea[0][i] + (A[i] == 'A'); } for(int i = 0; i < A.length(); i++) { prea[1][i+1] = prea[1][i] + (A[i] == 'T'); } for(int i = 0; i < A.length(); i++) { prea[2][i+1] = prea[2][i] + (A[i] == 'C'); } for(int i = 0; i < B.length(); i++) { preb[0][i+1] = preb[0][i] + (B[i] == 'A'); } for(int i = 0; i < B.length(); i++) { preb[1][i+1] = preb[1][i] + (B[i] == 'T'); } for(int i = 0; i < B.length(); i++) { preb[2][i+1] = preb[2][i] + (B[i] == 'C'); } for(int i = 0; i < A.length(); i++) { prec[i+1] = prec[i] + (A[i] == B[i]); } }

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

dna.cpp: In function 'int main()':
dna.cpp:33:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for(int i = 0; i < A.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int i = 0; i < A.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i = 0; i < A.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for(int i = 0; i < B.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:45:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |  for(int i = 0; i < B.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |  for(int i = 0; i < B.length(); i++) {
      |                 ~~^~~~~~~~~~~~
dna.cpp:51:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |  for(int i = 0; i < A.length(); i++) {
      |                 ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccriGpPA.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0SQjZy.o:dna.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status