제출 #729056

#제출 시각아이디문제언어결과실행 시간메모리
729056vjudge1DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define pdd pair<long double,long double>
#define pipii pair<int,pii>
#define plpll pair<ll,pll>
#define vi vector<int>
#define vvi vector<vi>
#define v3i vector<vvi>
#define v4i vector<v3i>
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define ins insert
#define ln '\n'
#define all(v) v.begin(),v.end()

vector<char>a,b;

void init(string s1,string s2){
    a.eb(' ');
    b.eb(' ');
    for(int i=0;i<s1.size();++i){
        a.eb(s1[i]);
        b.eb(s2[i]);
    }
}

int get_distance(int x,int y){
    int res=0;
    x++;
    y++;
    for(int i=x;i<=y;++i){
        if(a[i]!=b[i]){
            res++;
        }
    }
    if(res==0) return 0;
    else return res-1;
}

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

dna.cpp:23:1: error: 'vector' does not name a type
   23 | vector<char>a,b;
      | ^~~~~~
dna.cpp:25:6: error: variable or field 'init' declared void
   25 | void init(string s1,string s2){
      |      ^~~~
dna.cpp:25:11: error: 'string' was not declared in this scope
   25 | void init(string s1,string s2){
      |           ^~~~~~
dna.cpp:25:11: note: suggested alternatives:
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note:   'std::string'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dna.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
dna.cpp:25:21: error: 'string' was not declared in this scope
   25 | void init(string s1,string s2){
      |                     ^~~~~~
dna.cpp:25:21: note: suggested alternatives:
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dna.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note:   'std::string'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dna.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:39:12: error: 'a' was not declared in this scope
   39 |         if(a[i]!=b[i]){
      |            ^
dna.cpp:39:18: error: 'b' was not declared in this scope
   39 |         if(a[i]!=b[i]){
      |                  ^