結果

問題 No.5007 Steiner Space Travel
ユーザー snow39
提出日時 2022-07-30 15:22:56
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.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
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

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;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0