結果
問題 | No.5016 Worst Mayor |
ユーザー |
![]() |
提出日時 | 2023-04-29 13:45:44 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 1,406 bytes |
コンパイル時間 | 1,360 ms |
コンパイル使用メモリ | 98,292 KB |
実行使用メモリ | 24,336 KB |
スコア | 8,407,805,899 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 13:45:55 |
合計ジャッジ時間 | 9,767 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include <cmath>#include <vector>#include <iostream>#include <algorithm>using namespace std;int main() {const int D = 14;int N, T;cin >> N >> T;vector<int> X(N), Y(N);for (int i = 0; i < N; i++) {int a, b, c, d;cin >> a >> b >> c >> d;X[i] = (a - 1) * D + (b - 1);Y[i] = (c - 1) * D + (d - 1);}vector<vector<int> > v;for (int i = 1; i <= D; i++) {for (int j = 1; j <= D; j++) {if (j != D) {v.push_back({i, j, i, j + 1});}if (i != D) {v.push_back({i, j, i + 1, j});}}}auto level = [](int x) {return __builtin_ctz(x);};auto dist = [](const vector<int>& v) {return abs(v[0] - 8) + abs(v[1] - 8) + abs(v[2] - 8) + abs(v[3] - 8);};sort(v.begin(), v.end(), [&](vector<int> vx, vector<int> vy) {int lx = max({level(vx[0]), level(vx[1]), level(vx[2]), level(vx[3])});int ly = max({level(vy[0]), level(vy[1]), level(vy[2]), level(vy[3])});if (lx != ly) return lx > ly;return dist(vx) < dist(vy);});int cur = 0;for (int i = 0; i < T; i++) {int a, b;cin >> a >> b;if (i < T / 4) {cout << 2 << endl;}else if (i < T * 3 / 4) {int req = int(10000000 / sqrt(b));if (a >= req) {cout << 1 << ' ' << v[cur][0] << ' ' << v[cur][1] << ' ' << v[cur][2] << ' ' << v[cur][3] << endl;cur += 1;}else {cout << 3 << endl;}}else {cout << 3 << endl;}}return 0;}