#include #include using namespace std; int N, T; int A[3009], B[3009], C[3009], D[3009]; int Build[1009]; int CountRoads = 0; bool usedA[11][11]; bool usedB[11][11]; int main() { // Input cin >> N >> T; for (int i = 1; i <= N; i++) cin >> A[i] >> B[i] >> C[i] >> D[i]; for (int i = 1; i <= 1000; i++) Build[i] = (int)(10000000.0 / sqrt(1.0 * i)); // Interactive for (int i = 1; i <= T; i++) { int CurrentMoney; int CurrentCorp; cin >> CurrentMoney >> CurrentCorp; if (CurrentMoney == -1 && CurrentCorp == -1) break; cerr << CurrentMoney << " " << CurrentCorp << " " << CountRoads << endl; // 行動の設定 if (i <= 30) { cout << "3" << endl; } else if (i > 300) { cout << "3" << endl; } else if (CurrentMoney < Build[CurrentCorp]) { cout << "2" << endl; } else { bool flag = false; for (int i = 0; i < 500; i++) { int ty = rand() % 2; int a1 = rand() % 10 + 1; int a2 = rand() % 10 + 1; if (ty == 0 && a2 == 10) continue; if (ty == 1 && a1 == 10) continue; if (ty == 0 && usedA[a1][a2] == true) continue; if (ty == 1 && usedB[a1][a2] == true) continue; if (ty == 0) { usedA[a1][a2] = true; cout << 1 << " " << a1 << " " << a2 << " " << a1 << " " << a2 + 1 << endl; } if (ty == 1) { usedB[a1][a2] = true; cout << 1 << " " << a1 << " " << a2 << " " << a1 + 1 << " " << a2 << endl; } flag = true; CountRoads += 1; break; } if (flag == false) { cout << "2" << endl; } } } return 0; }