#include <iostream>
using namespace std;
struct A {virtual void foo(){}};
struct B {virtual void foo(){}};
int main() {
A *a = new A();
B *b = new B();
A *aPtr1 = dynamic_cast<A*>(b);
cout << (aPtr1 == 0) << endl;
A *aPtr2 = dynamic_cast<A*>(a);
cout << (aPtr2 == 0) << endl;
delete a;
delete b;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBBIHt2aXJ0dWFsIHZvaWQgZm9vKCl7fX07CnN0cnVjdCBCIHt2aXJ0dWFsIHZvaWQgZm9vKCl7fX07CgppbnQgbWFpbigpIHsKICAgIEEgKmEgPSBuZXcgQSgpOwkKICAgIEIgKmIgPSBuZXcgQigpOwogICAgQSAqYVB0cjEgPSBkeW5hbWljX2Nhc3Q8QSo+KGIpOwogICAgY291dCA8PCAoYVB0cjEgPT0gMCkgPDwgZW5kbDsKICAgIEEgKmFQdHIyID0gZHluYW1pY19jYXN0PEEqPihhKTsKICAgIGNvdXQgPDwgKGFQdHIyID09IDApIDw8IGVuZGw7CiAgICBkZWxldGUgYTsKICAgIGRlbGV0ZSBiOwoJcmV0dXJuIDA7Cn0=