#include #include #include using namespace std; int n; vector v; map< pair, int> M; bool qry(int st, int dr) { pair p = make_pair(st, dr); if(M.count(p)) return M[p]; cout << "1 " << st << " " << dr << "\n"; cout.flush(); bool ret; cin >> ret; M[p] = ret; return ret; } int bsearch(int st) { int step = 1; for(; st + step <= n && qry(st, st + step); step *= 2); step /= 2; int lo = st + step + 1; int hi = st + 2 * step - 1; int lq = lo - 1; if(lo > n) lo = n; if(hi > n) hi = n; while(lo <= hi) { int mid = (lo + hi) / 2; bool q = qry(st, mid); if(q) { lq = mid; lo = mid + 1; } else { hi = mid - 1; } } return lq; } int main() { cin >> n; int at = 1; while(at <= n) { int fin = bsearch(at); v.push_back(at); at = fin + 1; } cout << "2 " << v.size() << " "; for(auto i: v) cout << i << " "; cout << "\n"; return 0; }