結果

問題 No.5007 Steiner Space Travel
ユーザー snow39snow39
提出日時 2022-07-30 15:22:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,551 bytes
コンパイル時間 894 ms
実行使用メモリ 5,160 KB
スコア 1,221,702
最終ジャッジ日時 2022-07-30 15:22:59
合計ジャッジ時間 2,730 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
純コード判定しない問題か言語
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,904 KB
testcase_01 AC 2 ms
4,900 KB
testcase_02 AC 2 ms
4,904 KB
testcase_03 AC 2 ms
4,904 KB
testcase_04 AC 1 ms
5,160 KB
testcase_05 AC 1 ms
4,900 KB
testcase_06 AC 2 ms
4,900 KB
testcase_07 AC 1 ms
4,904 KB
testcase_08 AC 2 ms
5,160 KB
testcase_09 AC 2 ms
5,160 KB
testcase_10 AC 1 ms
4,904 KB
testcase_11 AC 1 ms
4,900 KB
testcase_12 AC 1 ms
4,904 KB
testcase_13 AC 2 ms
4,900 KB
testcase_14 AC 1 ms
5,160 KB
testcase_15 AC 1 ms
4,904 KB
testcase_16 AC 1 ms
4,900 KB
testcase_17 AC 2 ms
4,908 KB
testcase_18 AC 1 ms
5,160 KB
testcase_19 AC 1 ms
4,904 KB
testcase_20 AC 2 ms
4,900 KB
testcase_21 AC 2 ms
4,900 KB
testcase_22 AC 1 ms
4,904 KB
testcase_23 AC 2 ms
4,900 KB
testcase_24 AC 2 ms
4,900 KB
testcase_25 AC 2 ms
5,156 KB
testcase_26 AC 2 ms
4,904 KB
testcase_27 AC 1 ms
4,904 KB
testcase_28 AC 1 ms
4,900 KB
testcase_29 AC 1 ms
5,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <chrono>
#include <iostream>
#include <random>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
template <class T>
void chmin(T &a, const T &b) {
    if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
    if (a < b) a = b;
}

constexpr int N = 100;
constexpr int M = 8;

class Timer {
public:
    chrono::time_point<chrono::system_clock> start;

    Timer() {}

    void init() {
        start = chrono::system_clock::now();
    }

    int get_ms() {
        auto cur = chrono::system_clock::now();
        return chrono::duration_cast<chrono::milliseconds>(cur - start).count();
    }
};

struct Coordinate {
    int x;
    int y;

    Coordinate(int x = -1, int y = -1) : x(x), y(y) {}

    bool operator==(const Coordinate &rhs) const {
        return x == rhs.x && y == rhs.y;
    }
    bool operator!=(const Coordinate &rhs) const {
        return x != rhs.x || y != rhs.y;
    }

    int get_manhattan_dist(const Coordinate &other) const {
        int dx = abs(x - other.x);
        int dy = abs(y - other.y);
        return dx + dy;
    }

    int get_euclid_dist_squared(const Coordinate &other) const {
        int dx = abs(x - other.x);
        int dy = abs(y - other.y);
        return dx * dx + dy * dy;
    }
};

struct Planet {
    int id;
    Coordinate pos;
    Planet(int id, Coordinate pos) : id(id), pos(pos) {}
};

struct Input {
    vector<Planet> planets;
    Input(vector<Planet> planets) : planets(planets) {}
};

struct Output {
    int type;
    int id;
    Output(int type, int id) : type(type), id(id) {}
};

Timer timer;

Input read_input() {
    // Timer timer;
    timer.init();

    int n, m;
    cin >> n >> m;
    vector<Planet> planets;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        planets.emplace_back(i, Coordinate(a, b));
    }

    Input input(planets);
    return input;
}

void solve(const Input &input) {
    vector<Output> outputs;
    for (int i = 0; i < N; i++) outputs.emplace_back(1, input.planets[i].id + 1);
    outputs.emplace_back(1, input.planets[0].id + 1);

    rep(i, M) cout << 0 << " " << 0 << "\n";

    cout << outputs.size() << "\n";
    for (auto out : outputs) cout << out.type << " " << out.id << "\n";

    cerr << "end time: " << timer.get_ms() << "[ms]" << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    Input input = read_input();
    solve(input);

    return 0;
}
0