結果

問題 No.5009 Draw A Convex Polygon
ユーザー ikdikd
提出日時 2022-12-02 13:35:32
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,410 bytes
コンパイル時間 974 ms
実行使用メモリ 36,020 KB
スコア 0
平均クエリ数 1000001.00
最終ジャッジ日時 2022-12-02 13:35:38
合計ジャッジ時間 6,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let n = 1_000_000;
    // (1e9, 0) -> ... -> (0, 1e9) -> ... -> (-1e9, 0) -> ... -> (0, -1e9)
    // (1000000 - 4) / 4 = 249999

    let mut points_1 = Vec::new();
    let (mut x, mut y) = (1_000_000_000_i64, 0);
    for _ in 0..(n - 4) / 4 {
        x -= 1;
        y += 2;
        points_1.push((x, y));
    }

    let mut points_2 = Vec::new();
    let (mut x, mut y) = (0, 1_000_000_000_i64);
    for _ in 0..(n - 4) / 4 {
        x -= 1;
        y -= 2;
        points_2.push((x, y));
    }

    let mut points_3 = Vec::new();
    let (mut x, mut y) = (-1_000_000_000_i64, 0);
    for _ in 0..(n - 4) / 4 {
        x += 1;
        y -= 2;
        points_3.push((x, y));
    }

    let mut points_4 = Vec::new();
    let (mut x, mut y) = (0, -1_000_000_000_i64);
    for _ in 0..(n - 4) / 4 {
        x += 1;
        y += 2;
        points_4.push((x, y));
    }

    let mut ans = Vec::new();
    ans.push((1_000_000_000_i64, 0));
    ans.extend(points_1);
    ans.push((0, 1_000_000_000_i64));
    ans.extend(points_2);
    ans.push((-1_000_000_000_i64, 0));
    ans.extend(points_3);
    ans.push((0, -1_000_000_000_i64));
    ans.extend(points_4);
    assert_eq!(ans.len(), n);

    println!("{}", n);
    for (x, y) in ans {
        assert!(-1_000_000_000 <= x && x <= 1_000_000_000);
        assert!(-1_000_000_000 <= y && y <= 1_000_000_000);
        println!("{} {}", x, y);
    }
}
0