結果
問題 | No.5016 Worst Mayor |
ユーザー | phocom |
提出日時 | 2023-04-29 14:02:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 4,071 bytes |
コンパイル時間 | 1,535 ms |
コンパイル使用メモリ | 132,556 KB |
実行使用メモリ | 24,300 KB |
スコア | 3,135,147,320 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 14:02:10 |
合計ジャッジ時間 | 9,165 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
24,024 KB |
testcase_01 | AC | 81 ms
23,448 KB |
testcase_02 | AC | 82 ms
23,364 KB |
testcase_03 | AC | 85 ms
23,856 KB |
testcase_04 | AC | 85 ms
23,460 KB |
testcase_05 | AC | 84 ms
24,036 KB |
testcase_06 | AC | 84 ms
23,856 KB |
testcase_07 | AC | 84 ms
23,460 KB |
testcase_08 | AC | 83 ms
23,532 KB |
testcase_09 | AC | 84 ms
23,376 KB |
testcase_10 | AC | 83 ms
23,448 KB |
testcase_11 | AC | 83 ms
23,040 KB |
testcase_12 | AC | 84 ms
24,228 KB |
testcase_13 | AC | 83 ms
24,060 KB |
testcase_14 | AC | 84 ms
23,472 KB |
testcase_15 | AC | 82 ms
23,424 KB |
testcase_16 | AC | 84 ms
23,184 KB |
testcase_17 | AC | 84 ms
23,844 KB |
testcase_18 | AC | 83 ms
24,300 KB |
testcase_19 | AC | 84 ms
23,352 KB |
testcase_20 | AC | 84 ms
23,532 KB |
testcase_21 | AC | 84 ms
23,832 KB |
testcase_22 | AC | 81 ms
23,640 KB |
testcase_23 | AC | 81 ms
23,856 KB |
testcase_24 | AC | 83 ms
23,352 KB |
testcase_25 | AC | 83 ms
23,628 KB |
testcase_26 | AC | 83 ms
24,024 KB |
testcase_27 | AC | 84 ms
23,844 KB |
testcase_28 | AC | 78 ms
23,844 KB |
testcase_29 | AC | 82 ms
23,628 KB |
testcase_30 | AC | 85 ms
23,844 KB |
testcase_31 | AC | 83 ms
23,196 KB |
testcase_32 | AC | 84 ms
23,616 KB |
testcase_33 | AC | 82 ms
23,844 KB |
testcase_34 | AC | 83 ms
23,208 KB |
testcase_35 | AC | 86 ms
23,184 KB |
testcase_36 | AC | 84 ms
23,844 KB |
testcase_37 | AC | 77 ms
23,628 KB |
testcase_38 | AC | 83 ms
23,220 KB |
testcase_39 | AC | 83 ms
23,628 KB |
testcase_40 | AC | 82 ms
23,208 KB |
testcase_41 | AC | 83 ms
23,196 KB |
testcase_42 | AC | 82 ms
24,156 KB |
testcase_43 | AC | 82 ms
23,628 KB |
testcase_44 | AC | 83 ms
23,832 KB |
testcase_45 | AC | 82 ms
23,352 KB |
testcase_46 | AC | 81 ms
23,208 KB |
testcase_47 | AC | 83 ms
24,156 KB |
testcase_48 | AC | 83 ms
23,532 KB |
testcase_49 | AC | 83 ms
23,208 KB |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2") #define REP(i, N) for (int i = 0; i < (int)N; i++) #define FOR(i, a, b) for (int i = a; i < (int)b; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long; using Pii = pair<int, int>; constexpr int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; struct Timer { static constexpr double ONE_CLOCK = 0.000000333; unsigned long long get_cycle() { unsigned int low, high; __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); return ((unsigned long long int)low) | ((unsigned long long int)high << 32); } unsigned long long start_time, last_time; Timer() { start_time = last_time = get_cycle(); } int get_time() { return get_cycle() * ONE_CLOCK - start_time * ONE_CLOCK; } int split_time() { return get_cycle() * ONE_CLOCK - last_time * ONE_CLOCK; } void split() { last_time = get_cycle(); } } timer; class RandInt { public: int x = 8753, y = 239017, z = 1000000123; int next(int d) { int t = x ^ (x << 11); x = y; y = z; z ^= (z >> 19) ^ t ^ (t >> 8); return z % d; } } ri; template <class T> string to_string(T s); template <class S, class T> string to_string(pair<S, T> p); string to_string(char c) { return string(1, c); } string to_string(string s) { return s; } string to_string(const char s[]) { return string(s); } template <class T> string to_string(T v) { if (v.empty()) return "{}"; string ret = "{"; for (auto x : v) ret += to_string(x) + ","; ret.back() = '}'; return ret; } template <class S, class T> string to_string(pair<S, T> p) { return "{" + to_string(p.first) + ":" + to_string(p.second) + "}"; } void debug() { cerr << endl; } template <class Head, class... Tail> void debug(Head head, Tail... tail) { cerr << to_string(head) << " "; debug(tail...); } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template <class TP, size_t SZ = 40000> struct FQueue { TP arr[SZ]; int head = 0, tail = 0; int size() { return head <= tail ? tail - head : (tail + SZ - head); } void push(TP p) { arr[tail++] = p; if (tail == SZ) tail = 0; } void clear() { head = tail = 0; } TP front() { return arr[head]; } bool empty() { return head == tail; } TP pop() { TP ret = arr[head++]; if (head == SZ) head = 0; return ret; } }; #include <random> struct Point { int x, y; Point() {} Point(int _y, int _x) : x(_x), y(_y) {} }; constexpr int N = 3000, T = 400; Point s[N], t[N]; ll u = 1000000, v = 1; struct Judge { int local = 0; void read_problem() { if (local) { } else { int _; cin >> _ >> _; REP(i, N) { cin >> s[i].y >> s[i].x >> t[i].y >> t[i].x; } } } void get() { if (local) { } else { cin >> u >> v; } } void build(int x, int y, int z, int w) { cout << 1 << " " << x << " " << y << " " << z << " " << w << endl; } void gather() { cout << 2 << endl; } void donate() { cout << 3 << endl; } } judge; ll get_cost() { return 10000000 / sqrt(v); } constexpr int inf = 1 << 27; int main(int argc, char **argv) { if (argc == 2) { judge.local = 1; } judge.read_problem(); queue<tuple<int, int, int, int>> que; FOR(i, 6, 10) { que.emplace(i, i, i + 1, i); que.emplace(i, i, i, i + 1); } REP(q, T) { judge.get(); if (v < 25) { judge.gather(); } else if (q < 300 && !que.empty() && get_cost() <= u) { auto tp = que.front(); que.pop(); judge.build(get<0>(tp), get<1>(tp), get<2>(tp), get<3>(tp)); } else { judge.donate(); } } return 0; }