結果

問題 No.1519 Diversity
ユーザー haya3
提出日時 2021-08-19 23:44:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 171,392 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 01:35:16
合計ジャッジ時間 3,239 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


int main() {
  ll n;
  cin >> n;
  vector<vector<int>> G(n, vector<int> (n));
  int nodes = 0;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n - i; j++){
      G[i][j] = 1;
      nodes++;
    }
  }
  cout << nodes << endl;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      if(G[i][j]) cout << i + 1 << " " << j + 1 << endl;
    }
  }
  return 0;
}
0