結果
| 問題 |
No.5016 Worst Mayor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-29 14:02:00 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.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 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#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;
}