結果
問題 |
No.5016 Worst Mayor
|
ユーザー |
![]() |
提出日時 | 2023-04-28 21:35:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 1,544 bytes |
コンパイル時間 | 710 ms |
コンパイル使用メモリ | 70,260 KB |
実行使用メモリ | 24,372 KB |
スコア | 5,513,624,424 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 12:31:59 |
合計ジャッジ時間 | 8,485 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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[16][16]; bool usedB[16][16]; 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 > 280) { 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() % 14 + 1; int a2 = rand() % 14 + 1; if (ty == 0 && a2 == 14) continue; if (ty == 1 && a1 == 14) 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; }