結果
| 問題 | No.3506 All Distance is Square Number |
| コンテスト | |
| ユーザー |
KowerKoint2010
|
| 提出日時 | 2026-04-19 09:06:11 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 948 bytes |
| 記録 | |
| コンパイル時間 | 2,690 ms |
| コンパイル使用メモリ | 331,188 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-19 10:10:55 |
| 合計ジャッジ時間 | 5,363 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1ll << 60;
#define REP(i, n) for(ll i =0; i < ll(n); i++)
template <class T> using V = vector<T>;
template <class A, class B>
bool chmax(A& a, B b) { return a<b && (a=b, true); }
template <class A, class B>
bool chmin(A& a, B b) { return b<a && (a=b, true); }
void testcase() {
int n; cin >> n;
cout << n*2-3 << '\n';
REP(i, n-1) {
cout << i+1 << ' ' << i+2 << ' ' << i*2+1 << '\n';
}
REP(i, n-2) {
cout << 2 << ' ' << i+3 << ' ' << i*2+4 << '\n';
}
for(int i = 1; i < n; i++) for(int j = i+1; j <= n; j++) {
if(i == 1) {
cout << j-1;
REP(k, j-1) cout << ' ' << k+1;
cout << '\n';
} else {
cout << j-2;
REP(k, i-2) cout << ' ' << i-1-k;
cout << ' ' << i+n-2;
REP(k, j-i-1) cout << ' ' << i+1+k;
cout << '\n';
}
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
testcase();
}
KowerKoint2010