結果
| 問題 | No.5016 Worst Mayor | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-04-29 15:19:14 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 3,003 bytes | 
| コンパイル時間 | 2,516 ms | 
| コンパイル使用メモリ | 168,716 KB | 
| 実行使用メモリ | 26,008 KB | 
| スコア | 0 | 
| 最終ジャッジ日時 | 2023-04-29 15:19:30 | 
| 合計ジャッジ時間 | 8,642 ms | 
| ジャッジサーバーID (参考情報) | judge12 / judge11 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 49 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define REPITR(itr, ARRAY) for (auto itr = (ARRAY).begin(); itr != (ARRAY).end(); ++itr)
#define RREPITR(itr, ARRAY) for (auto itr = (ARRAY).rbegin(); itr != (ARRAY).rend(); ++itr)
#define ALL(n) (n).begin(), (n).end()
using ll = long long;
using ull = unsigned long long;
// #define int long long
template<typename T>
struct edge {
    int to;
    T cost;
    edge() {}
    edge(int to, T cost):
        to(to), cost(cost) {}
};
ll N; // 3000 fixed
ll T; // 400 fixed
vector<pair<pair<int, int>, pair<int, int>>> working_pathes;
ll money = 1e6;
ll constexpr cost_base = 1e7;
ll collaborater = 1;
ll constexpr grid_size = 14;
pair<int, int> dir[4] = {pair<int, int>(0, 1), pair<int, int>(0, -1), pair<int, int>(1, 0), pair<int, int>(-1, 0)};
set<pair<int, int>> is_constructed;
signed main() {
    cin >> N >> T;
    working_pathes.resize(N);
    REP(i, N) {
        cin >> working_pathes[i].first.first
            >> working_pathes[i].first.second
            >> working_pathes[i].second.first
            >> working_pathes[i].second.second;
    }
    REP(_never_use_this_variable, T) {
        cin >> money >> collaborater;
        if (collaborater < 10) {
            cout << 2 << endl;
            continue;
        }
        map<pair<pair<int, int>, pair<int, int>>, int> seen_count;
        REP(n, N) {
            pair<int, int> start = working_pathes[n].first;
            pair<int, int> end = working_pathes[n].second;
            vector<vector<bool>> seen(grid_size, vector<bool>(grid_size));
            deque<pair<int, int>> que;
            que.push_back(start);
            while (!que.empty()) {
                pair<int, int> c = que.front();
                que.pop_front();
                if (c == end) {
                    break;
                }
                for (auto d: dir) {
                    auto n = c;
                    n.first += d.first;
                    n.second += d.second;
                    if (is_constructed.find(n) == is_constructed.end()) {
                        seen_count[pair<pair<int, int>, pair<int, int>>(c, n)] += 1;
                    }
                    if (seen[n.first][n.second]) {
                        continue;
                    }
                    if (is_constructed.find(n) != is_constructed.end()) {
                        que.push_front(n);
                    } else {
                        que.push_back(n);
                    }
                }
            }
        }
        auto ma = *max_element(ALL(seen_count));
        if (money >= cost_base / sqrt(collaborater)) {
            cout << 1 << " "
                 << ma.first.first.first << ma.first.first.second
                 << ma.first.second.first << ma.first.second.second
                 << endl;
        } else {
            cout << 3 << endl;
        }
    }
    return 0;
}
            
            
            
        