結果
問題 | No.5016 Worst Mayor |
ユーザー | tempura_pp |
提出日時 | 2023-04-29 14:46:45 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 986 ms / 2,000 ms |
コード長 | 4,108 bytes |
コンパイル時間 | 2,360 ms |
コンパイル使用メモリ | 139,388 KB |
実行使用メモリ | 24,396 KB |
スコア | 20,388,782,779 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 14:47:42 |
合計ジャッジ時間 | 51,137 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 942 ms
24,348 KB |
testcase_01 | AC | 898 ms
24,048 KB |
testcase_02 | AC | 920 ms
23,628 KB |
testcase_03 | AC | 925 ms
23,664 KB |
testcase_04 | AC | 950 ms
23,400 KB |
testcase_05 | AC | 887 ms
23,664 KB |
testcase_06 | AC | 929 ms
23,388 KB |
testcase_07 | AC | 919 ms
23,544 KB |
testcase_08 | AC | 909 ms
24,324 KB |
testcase_09 | AC | 905 ms
24,048 KB |
testcase_10 | AC | 925 ms
24,336 KB |
testcase_11 | AC | 928 ms
23,640 KB |
testcase_12 | AC | 891 ms
24,336 KB |
testcase_13 | AC | 926 ms
23,844 KB |
testcase_14 | AC | 937 ms
24,348 KB |
testcase_15 | AC | 892 ms
24,036 KB |
testcase_16 | AC | 936 ms
23,376 KB |
testcase_17 | AC | 910 ms
24,048 KB |
testcase_18 | AC | 924 ms
24,024 KB |
testcase_19 | AC | 891 ms
24,348 KB |
testcase_20 | AC | 927 ms
23,424 KB |
testcase_21 | AC | 932 ms
23,640 KB |
testcase_22 | AC | 986 ms
24,048 KB |
testcase_23 | AC | 889 ms
23,628 KB |
testcase_24 | AC | 913 ms
23,640 KB |
testcase_25 | AC | 902 ms
23,424 KB |
testcase_26 | AC | 919 ms
23,388 KB |
testcase_27 | AC | 925 ms
24,396 KB |
testcase_28 | AC | 932 ms
23,856 KB |
testcase_29 | AC | 936 ms
23,844 KB |
testcase_30 | AC | 909 ms
23,640 KB |
testcase_31 | AC | 953 ms
24,048 KB |
testcase_32 | AC | 921 ms
23,388 KB |
testcase_33 | AC | 911 ms
23,424 KB |
testcase_34 | AC | 921 ms
24,336 KB |
testcase_35 | AC | 927 ms
23,436 KB |
testcase_36 | AC | 935 ms
23,436 KB |
testcase_37 | AC | 930 ms
23,400 KB |
testcase_38 | AC | 909 ms
23,388 KB |
testcase_39 | AC | 927 ms
24,036 KB |
testcase_40 | AC | 926 ms
23,412 KB |
testcase_41 | AC | 896 ms
23,856 KB |
testcase_42 | AC | 911 ms
23,652 KB |
testcase_43 | AC | 907 ms
23,844 KB |
testcase_44 | AC | 969 ms
23,844 KB |
testcase_45 | AC | 919 ms
23,556 KB |
testcase_46 | AC | 919 ms
23,640 KB |
testcase_47 | AC | 907 ms
23,400 KB |
testcase_48 | AC | 889 ms
23,556 KB |
testcase_49 | AC | 920 ms
23,628 KB |
ソースコード
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; constexpr int inf = 1e9 + 7; constexpr ll longinf = 1LL << 60; constexpr ll mod = 1e9 + 7; struct Xor128 { unsigned x, y, z, w; Xor128(unsigned w_ = 88675123) : x(123456789), y(362436069), z(521288629), w(w_){}; inline unsigned xor128() { unsigned t; t = x ^ (x << 11); x = y; y = z; z = w; return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); } int nextInt(int x, int y) { if(x > y) swap(x, y); return xor128() % (y - x) + x; } double nextDouble(double a, double b) { return (double)(xor128() & 0xffff) / 0xffff * (b - a) + a; } }; int dist[200][200]; int N = 3000, T = 400, M = 196; int cost[3030]; int s[3030], t[3030]; int NC = 100000, NH = 22301; bool skip(int x) { int i = x / 14, j = x % 14; return i % 2 == 1 && j % 2 == 1; } int if_update(int v1, int v2) { if(skip(v1) || skip(v2)) { return 0; } int res = 0; rep(i, N) { int nc = min(dist[s[i]][t[i]], min(dist[s[i]][v1] + dist[v2][t[i]] + NH, dist[s[i]][v2] + dist[v1][t[i]] + NH)); res += nc % 100; } return res; } void update(int v1, int v2) { dist[v1][v2] = NH; dist[v2][v1] = NH; rep(i, M) rep(j, M) { dist[i][j] = min(dist[i][j], min(dist[i][v1] + dist[v2][j] + NH, dist[i][v2] + dist[v1][j] + NH)); } } void input() { int _; cin >> _ >> _; rep(i, N) { int a, b, c, d; cin >> a >> b >> c >> d; --a; --b; --c; --d; s[i] = a * 14 + b; t[i] = c * 14 + d; } rep(i, 200) rep(j, 200) { dist[i][j] = NC * 50; } rep(i, 14) rep(j, 14) { int x = i * 14 + j; if(j > 0) { dist[x][x - 1] = NC; } if(j < 13) { dist[x][x + 1] = NC; } if(i > 0) { dist[x][x - 14] = NC; } if(i < 13) { dist[x][x + 14] = NC; } dist[x][x] = 0; } rep(i, M) rep(j, M) rep(k, M) { dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]); } } int num = 0; void output(int x, int y) { cout << 1 << " "; cout << x / 14 + 1 << " " << x % 14 + 1 << " "; cout << y / 14 + 1 << " " << y % 14 + 1 << endl; ++num; } auto rng = Xor128(); int cur = 0; int U = 1000000, V = 1; pair<int, int> read() { cerr << cur << " " << U << " " << V << endl; return {U, V}; int u, v; cin >> u >> v; return {u, v}; } void turn(int t) { auto p = read(); int u = p.first, v = p.second; int ma = 0, mx = 0, my = 0; rep(f, 2 * 14 * 13) { // int e = rng.nextInt(0, 2 * 14 * 13); int e = f; int x, y; if(e < 13 * 14) { x = (e / 13) * 14 + e % 13; y = x + 1; } else { e -= 13 * 14; x = e; y = e + 14; } int res = if_update(x, y); if(res > ma) { ma = res, mx = x, my = y; } } int ben = 60 * (ma - cur) * (T - t); int pay = (int)(10000000 / sqrt(v)); if(ben > pay && u > pay) { output(mx, my); update(mx, my); cur = ma; U = u - pay; } else { int npay = (int)(10000000 / sqrt(v + 1)); int dpay = max(0, min(80 - num, T - t - 1)) * (pay - npay); if(dpay > 50000) { cout << 2 << endl; V = v + 1; } else { cout << 3 << endl; U = u + 50000; } } U += cur * 60; } int main() { input(); rep(i, T) { turn(i); } cerr << U << " " << V << endl; cerr << num << endl; return 0; }