#include "validation.h" #include #include int maxq = 12000; int extraq = 3000; int main(int argc, char** argv) { std::ifstream in(argv[1]); OutputValidator v(argc, argv); // Read input. int w; long long h; in >> w >> h; std::vector hs(w); for(auto& hi : hs) in >> hi; std::cout << w << " " << h << std::endl; // Interactions. int queries = 0; while(true) { auto op = v.read_string("op", 1, 1, "?!"); v.space(); if(op == "?") { // Answer query. queries += 1; if(queries > maxq + extraq) { v.WA("Used more than ", maxq+extraq, " queries"); } int x = v.read_integer("x", 1, w); v.space(); long long y = v.read_integer("y", 1, h); v.newline(); if(y <= hs[x - 1]) { std::cout << "building" << std::endl; } else { std::cout << "sky" << std::endl; } } else if(op == "!") { int x = v.read_integer("xans", 1, w); v.space(); long long y = v.read_integer("yans", 0, h); v.newline(); auto max_idx = std::max_element(hs.begin(), hs.end()) - hs.begin(); long long maxh = hs[max_idx]; v.check(y == maxh, "Height ", y, " is not equal to the max of ", maxh, " in column ", max_idx + 1); v.check(hs[x - 1] == y, "The height in column ", x, " is ", hs[x - 1], " not ", y); if(queries > maxq){ v.WA("Used ", queries, " queries"); } std::cerr << "Used " << queries << " queries" << std::endl; break; } else { v.WA("unknown op ", op); } } }