제출 #567944

#제출 시각아이디문제언어결과실행 시간메모리
567944sdfsdfsddfDNA 돌연변이 (IOI21_dna)C++17
0 / 100
30 ms4116 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; const int max_n = 10e5+7; int literki1[max_n][2]{}; int literki2[max_n][2]{}; int do_zamiany[max_n]{}; void init(string a, string b){ int a2 = 0, c= 0, t =0; //a = 0 b = 1 c = 2 for(int i = 0; i < a.length();i++){ literki1[i][0] = a2; literki1[i][1] = c; literki1[i][2] = t; if(a[i] == 'A'){ a2++; literki1[i][0] += 1; } else if(a[i] == 'C'){ c++; literki1[i][1] += 1; } else{ t++; literki1[i][2] += 1; } } a2 = 0; c = 0; t = 0; for(int i = 0; i < a.length();i++){ literki2[i][0] = a2; literki2[i][1] = c; literki2[i][2] = t; if(b[i] == 'A'){ a2++; literki2[i][0] += 1; } else if(b[i] == 'C'){ c++; literki2[i][1] += 1; } else{ t++; literki2[i][2] += 1; } } int ile_zmienic = 0; for(int i = 0; i < a.length();i++){ if(a[i] != b[i]) ile_zmienic++; do_zamiany[i] = ile_zmienic; } } int get_distance(int x, int y){ int a1 = literki1[y][0]-literki1[x][0]; int c1 = literki1[y][1]-literki1[x][1]; int t1 = literki1[y][2]-literki1[x][2]; int a2 = literki1[y][0]-literki1[x][0]; int c2 = literki1[y][1]-literki1[x][1]; int t2 = literki1[y][2]-literki1[x][2]; if(a1 == a2 && c1 == c2 && t1 == t2){ int wyjscie = (do_zamiany[y]-do_zamiany[x]+1)/2; return wyjscie; } else{ return -1; } return 0; }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < a.length();i++){
      |                    ~~^~~~~~~~~~~~
dna.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int i = 0; i < a.length();i++){
      |                    ~~^~~~~~~~~~~~
dna.cpp:54:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i = 0; i < a.length();i++){
      |                    ~~^~~~~~~~~~~~
dna.cpp:39:22: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
   39 |         literki2[i][2] = t;
      |         ~~~~~~~~~~~~~^
dna.cpp:50:28: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
   50 |             literki2[i][2] += 1;
      |             ~~~~~~~~~~~~~~~^~~~
dna.cpp:18:22: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
   18 |         literki1[i][2] = t;
      |         ~~~~~~~~~~~~~^
dna.cpp:29:28: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
   29 |             literki1[i][2] += 1;
      |             ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...