結果

問題 No.5016 Worst Mayor
ユーザー e869120
提出日時 2023-04-23 17:44:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 1,658 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 89,784 KB
実行使用メモリ 24,396 KB
スコア 5,132,527,316
平均クエリ数 400.00
最終ジャッジ日時 2023-04-29 12:30:44
合計ジャッジ時間 8,403 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <tuple>
#include <vector>
#include <algorithm>
using namespace std;

int N, T;
int A[3009], B[3009], C[3009], D[3009];
int Build[1009];
int CountRoads = 0;
vector<tuple<int, int, int, int, int>> vec;

int Distance(int sx, int sy) {
	return (sx * 2 - 11) * (sx * 2 - 11) + (sy * 2 - 11) * (sy * 2 - 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));

	// Sort Order
	for (int i = 1; i <= 10; i++) {
		for (int j = 1; j <= 9; j++) vec.push_back(make_tuple(Distance(i, j) + Distance(i, j + 1), i, j, i, j + 1));
	}
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 10; j++) vec.push_back(make_tuple(Distance(i, j) + Distance(i + 1, j), i, j, i + 1, j));
	}
	sort(vec.begin(), vec.end());

	// 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 > 270) {
			cout << "3" << endl;
		}
		else if (CurrentMoney < Build[CurrentCorp]) {
			cout << "2" << endl;
		}
		else if (CountRoads < vec.size()) {
			int sx = get<1>(vec[CountRoads]);
			int sy = get<2>(vec[CountRoads]);
			int tx = get<3>(vec[CountRoads]);
			int ty = get<4>(vec[CountRoads]);
			cout << "1 " << sx << " " << sy << " " << tx << " " << ty << endl;
			CountRoads += 1;
		}
		else {
			cout << "2" << endl;
		}
	}
	return 0;
}
0