結果

問題 No.3506 All Distance is Square Number
コンテスト
ユーザー takuma saito
提出日時 2026-04-19 01:32:20
言語 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  
実行時間 -
コード長 811 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,527 ms
コンパイル使用メモリ 333,232 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-19 01:32:38
合計ジャッジ時間 10,122 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;

    if(N==1){
        cout << 0 << endl;
        return 0;
    }

    int M = N-1;
    cout << M << endl;

    vector<int> W;
    for(int x=1; x<=200 && (int)W.size()<M; x+=2) W.push_back(x);
    for(int x=4; x<=200 && (int)W.size()<M; x+=4) W.push_back(x);
    

    for(int i=1;i<=M;i++){
        int u = i;
        int v = i+1;
        int c = W[i-1];
        cout << u << " " << v << " " << c << "\n";
    }

    for(int i=1;i<=N-1;i++){
        for(int j=i+1;j<=N;j++){
            int len = j - i;
            cout << len;
            for(int e=i;e<=j-1;e++){
                cout << " " << e;
            }
            cout << endl;
        }
    }
    return 0;
}
0