結果

問題 No.3506 All Distance is Square Number
コンテスト
ユーザー nagasan0210
提出日時 2026-04-18 08:24:10
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,343 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,120 ms
コンパイル使用メモリ 335,040 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-18 08:24:21
合計ジャッジ時間 5,389 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(a); i > (int)(b); i--)
#define ll long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define PQ priority_queue<int, vector<int>, greater<int>>
#define PQ_g priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>>
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
const int d4[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
const int d8[8][2] = {{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}};
void Yes(bool b) {cout << (b ? "Yes" : "No") << endl;}

int main() {
    int n; cin >> n;
    cout << (2 * n - 3) << endl;
    rep(i, 1, n - 1) {
        cout << i << ' ' << n << ' ' << 9 << endl;
        cout << i << ' ' << n << ' ' << 16 << endl;
    }
    cout << (n - 1) << ' ' << n << ' ' << 9 << endl;

    rep(i, 1, n + 1) {
        rep(j, i + 1, n + 1) {
            if (i <= n - 2) {
                if (j != n) {
                    cout << 2 << ' ' << (2 * i) << ' ' << (2 * j - 1) << endl;
                } else {
                    cout << 1 << ' ' << (2 * i) << endl;
                }
            } else {
                cout << 1 << ' ' << (2 * n - 3) << endl;
            }
        }
    }
}
0