#include using namespace std; template ostream& operator<<(ostream& out, const vector &cont) { out << "["; for(const auto &x: cont) out << x<< ", "; out << "]"; return out; } #define dmp(x) cerr << #x << " = " << x << endl #define dmpn(x) cerr << #x << " = " << x <<"; " #define ff first #define ss second #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() #define int long long typedef long long ll; typedef pair pii; typedef long double ld; int zisti_cislo(){ int n; cin >> n; vector a(n); for(int i=0; i> a[i]; } int h = 0; for(int i=0; i0 && a[i+1][h-1] == '#'){ h--; ans = ans*2+1; } else{ h++; ans = ans*2; } } return ans; } void vypis_cislo(int x){ int r_w = 0, l_w = 0, curr_w = 0, height = 1, helper = x; vector p; while(helper > 1){ height++; if(helper%2){ curr_w++; p.push_back(0); } else{ curr_w--; p.push_back(1); } helper /= 2; r_w = max(r_w, curr_w); l_w = min(l_w, curr_w); } vector> a(height, vector(r_w-l_w+1, '.')); int h=curr_w-l_w; a[0][curr_w-l_w] = '#'; reverse(p.begin(), p.end()); for(int i=0; isync_with_stdio(0); cin.exceptions(cin.failbit); solve(); return 0; }