結果
| 問題 | No.5016 Worst Mayor | 
| コンテスト | |
| ユーザー |  e869120 | 
| 提出日時 | 2023-04-23 17:26:28 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 98 ms / 2,000 ms | 
| コード長 | 1,544 bytes | 
| コンパイル時間 | 735 ms | 
| コンパイル使用メモリ | 69,284 KB | 
| 実行使用メモリ | 24,348 KB | 
| スコア | 8,347,014,353 | 
| 平均クエリ数 | 400.00 | 
| 最終ジャッジ日時 | 2023-04-29 12:30:22 | 
| 合計ジャッジ時間 | 8,518 ms | 
| ジャッジサーバーID (参考情報) | judge11 / judge12 | 
| 純コード判定しない問題か言語 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 50 | 
ソースコード
#include <iostream>
#include <cmath>
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;
}
            
            
            
        