結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー |
![]() |
提出日時 | 2023-07-16 15:28:52 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 1,867 bytes |
コンパイル時間 | 2,143 ms |
コンパイル使用メモリ | 200,780 KB |
実行使用メモリ | 24,492 KB |
スコア | 450,310 |
平均クエリ数 | 1007.01 |
最終ジャッジ日時 | 2023-07-16 15:29:03 |
合計ジャッジ時間 | 10,921 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include <bits/stdc++.h>using ll = long long;using namespace std;array<int, 2> b[25][1100];int main() {int x = 12, y = 0, l = 100;for (int turn = 0; turn < 1000; turn++) {int n;cin >> n;if (n < 0) exit(0);for (int i = 0; i < n; i++) {int h, p, x;cin >> h >> p >> x;b[x][y + 60] = { h, p };}y++;int m = l / 100;char c = 'S';int r[25];for (int i = 0; i < 25; i++) {int s = 100;int d = abs(x - i);d = min(d, 25 - d);d = max(d - 1, 0);for (int j = 1 + d; j < 60; j++) {if (auto h = b[i][y + j][0]; h > 0) {int t = (h + m - 1) / m + d;if (t > j) s = 200; else s = t;break;}}r[i] = s;}int t[2] = {};for (int i = 1; i <= 12; i++) {t[0] |= b[(x + i + 25) % 25][y - 1 + i][0];t[1] |= b[(x - i + 25) % 25][y + 1 - i][0];if (t[0]) r[(x + i + 25) % 25] = 300;if (t[1]) r[(x - i + 25) % 25] = 300;}if (int i = min_element(r, r + 25) - r; i != x) c = "LR"[i - x > 0 ^ abs(i - x) > 12];cout << '#';for (int i = 0; i < 25; i++) {cout << r[i] << " \n"[i == 24];}cout << c << endl;x += (c == 'R') - (c == 'L');x = (x + 25) % 25;for (int j = 1; j < 60; j++) {if (auto &h = b[x][y + j][0]; h > 0) {h -= m;if (h <= 0) {h = 0;l += b[x][y + j][1];}cout << "#" << l << ' ' << h << '\n';break;}}}return 0;}