/* -*- coding: utf-8 -*- * * 2978.cc: No.2978 Lexicographically Smallest and Largest Subarray - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 1000; const int MAX_QN = 1500; /* typedef */ /* global variables */ int as[MAX_N], bs[MAX_N]; /* subroutines */ int query(int l0, int r0, int l1, int r1) { printf("? %d %d %d %d\n", l0 + 1, r0, l1 + 1, r1); fflush(stdout); int x; scanf("%d", &x); if (x < 0) exit(0); return x; } /* main */ int main() { int n, qn; scanf("%d%d", &n, &qn); int m = n / 2; for (int i = 0, j = m; i < m; i++, j++) { if (query(i, i + 1, j, j + 1)) as[i] = i, bs[i] = j; else as[i] = j, bs[i] = i; } int mini = as[0]; for (int i = 1; i < m; i++) if (query(as[i], as[i] + 1, mini, mini + 1)) mini = as[i]; int maxi = bs[0]; for (int i = 1; i < m; i++) if (! query(bs[i], n, maxi, n)) maxi = bs[i]; printf("! %d %d %d %d\n", mini + 1, mini + 1, maxi + 1, n); fflush(stdout); //for (int i = 0; i < 1000000000; i++); return 0; }