/* -*- coding: utf-8 -*- * * 282.cc: No.282 おもりと天秤(2) - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 500; /* typedef */ typedef pair pii; typedef vector vpii; typedef queue qpii; /* global variables */ int cmat[MAX_N][MAX_N], as[MAX_N]; bool used[MAX_N]; /* subroutines */ bool cmpcmat(const int &a, const int &b) { return cmat[a][b] < 0; } /* main */ int main() { int n; cin >> n; qpii aps; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) aps.push(pii(i, j)); int n2 = n * 2; while (! aps.empty()) { //printf("aps=%lu\n", aps.size()); putchar('?'); int k = 0; vpii qs; memset(used, false, sizeof(used)); while (k < n) { bool found = false; pii u; for (int i = 0; i < aps.size(); i++) { u = aps.front(); aps.pop(); if (! used[u.first] && ! used[u.second]) { found = true; break; } aps.push(u); } if (! found) { while (k < n) printf(" 0"), k++; } else { used[u.first] = used[u.second] = true; printf(" %d %d", u.first + 1, u.second + 1); qs.push_back(u); k += 2; } } for (int i = 0; i < n; i++) printf(" 0"); putchar('\n'); cout.flush(); for (int i = 0; i < n; i++) { char ch; cin >> ch; if (i < qs.size()) { int &li = qs[i].first, &ri = qs[i].second; int ci = (ch == '<') ? -1 : (ch == '>') ? 1 : 0; cmat[li][ri] = ci; cmat[ri][li] = -ci; } } } //for (int i = 0; i < n; i++) { //for (int j = 0; j < n; j++) printf(" %d", cmat[i][j]); //putchar('\n'); //} for (int i = 0; i < n; i++) as[i] = i; sort(as, as + n, cmpcmat); putchar('!'); for (int i = 0; i < n; i++) printf(" %d", as[i] + 1); putchar('\n'); cout.flush(); return 0; }