Submission #966767

# Submission time Handle Problem Language Result Execution time Memory
966767 2024-04-20T10:19:12 Z SuPythony Mutating DNA (IOI21_dna) C++17
Compilation error
0 ms 0 KB
#include "dna.h"
#include <bits/stdc++.h>
using namespace ststdc

vector<int> pf(1e5+1,0);

void init(string a, string b) {
    for (int i=1; i<=a.size(); i++) {
        if (a[i]!=b[i]) {
            pf[i]=pf[i-1]+1;
        } else {
            pf[i]=pf[i-1];
        }
    }
}

int get_distance(int x, int y) {
    int c=pf[y]-pf[x-1];
    return c/2+c%2;
}

Compilation message

dna.cpp:3:17: error: 'ststdc' is not a namespace-name
    3 | using namespace ststdc
      |                 ^~~~~~
dna.cpp:3:23: error: expected ';' before 'vector'
    3 | using namespace ststdc
      |                       ^
      |                       ;
    4 | 
    5 | vector<int> pf(1e5+1,0);
      | ~~~~~~                 
dna.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> pf(1e5+1,0);
      | ^~~~~~
dna.cpp:7:6: error: variable or field 'init' declared void
    7 | void init(string a, string b) {
      |      ^~~~
dna.cpp:7:11: error: 'string' was not declared in this scope
    7 | void init(string a, string b) {
      |           ^~~~~~
dna.cpp:7:11: note: suggested alternatives:
In file included from /usr/include/c++/10/string:39,
                 from dna.h:1,
                 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 dna.h:1,
                 from dna.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
dna.cpp:7:21: error: 'string' was not declared in this scope
    7 | void init(string a, string b) {
      |                     ^~~~~~
dna.cpp:7:21: note: suggested alternatives:
In file included from /usr/include/c++/10/string:39,
                 from dna.h:1,
                 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 dna.h:1,
                 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:18:11: error: 'pf' was not declared in this scope
   18 |     int c=pf[y]-pf[x-1];
      |           ^~