#include <iostream> #include <cstdint> #include <new> using namespace std; // Define your struct and placement new logic here struct Block { int id; int value; }; int main() { int id, value; cin >> id >> value; // Write your placement new construction code here alignas(Block) static uint8_t buffer[sizeof(Block)]; Block *ptr = new(buffer) Block; ptr->id = id; ptr->value = value; cout << ptr->id << " " << ptr->value; ptr->~Block(); return 0; }
Test Cases
Test Results
Input
7 42
Expected Output