제출 #1141923

#제출 시각아이디문제언어결과실행 시간메모리
1141923redimberocDNA 돌연변이 (IOI21_dna)C++20
컴파일 에러
0 ms0 KiB
#include "dna.h" void init(std::string k, std::string x) { } string a,b; int get_distance(int x, int y){ int count = 0, r= 0; vc result{}; vc result1{}; for(int i=x;i<=y;i++){ result.pb(a[i]); result1.pb(b[i]); } vc ans = result; vc ans1 = result1; sort(all(ans)); sort(all(ans1)); if(ans != ans1){ return -1; }else{ for(int i=0;i<sz(b);i++){ if(result[i] != result1[i]){ count++; } } } return count; }

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

dna.cpp:5:1: error: 'string' does not name a type; did you mean 'stdin'?
    5 | string a,b;
      | ^~~~~~
      | stdin
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:8:9: error: 'vc' was not declared in this scope
    8 |         vc result{};
      |         ^~
dna.cpp:9:11: error: expected ';' before 'result1'
    9 |         vc result1{};
      |           ^~~~~~~~
      |           ;
dna.cpp:11:9: error: 'result' was not declared in this scope
   11 |         result.pb(a[i]);
      |         ^~~~~~
dna.cpp:11:19: error: 'a' was not declared in this scope
   11 |         result.pb(a[i]);
      |                   ^
dna.cpp:12:9: error: 'result1' was not declared in this scope
   12 |         result1.pb(b[i]);
      |         ^~~~~~~
dna.cpp:12:20: error: 'b' was not declared in this scope
   12 |         result1.pb(b[i]);
      |                    ^
dna.cpp:14:11: error: expected ';' before 'ans'
   14 |         vc ans = result;
      |           ^~~~
      |           ;
dna.cpp:15:11: error: expected ';' before 'ans1'
   15 |         vc ans1 = result1;
      |           ^~~~~
      |           ;
dna.cpp:16:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         sort(all(ans));
      |                  ^~~
      |                  abs
dna.cpp:16:14: error: 'all' was not declared in this scope; did you mean 'atoll'?
   16 |         sort(all(ans));
      |              ^~~
      |              atoll
dna.cpp:16:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   16 |         sort(all(ans));
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/11/string:52,
                 from dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4863:5: note: 'std::sort' declared here
 4863 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
dna.cpp:17:18: error: 'ans1' was not declared in this scope
   17 |         sort(all(ans1));
      |                  ^~~~
dna.cpp:21:26: error: 'b' was not declared in this scope
   21 |         for(int i=0;i<sz(b);i++){
      |                          ^
dna.cpp:21:23: error: 'sz' was not declared in this scope
   21 |         for(int i=0;i<sz(b);i++){
      |                       ^~
dna.cpp:22:16: error: 'result' was not declared in this scope
   22 |             if(result[i] != result1[i]){
      |                ^~~~~~
dna.cpp:22:29: error: 'result1' was not declared in this scope
   22 |             if(result[i] != result1[i]){
      |                             ^~~~~~~