結果
| 問題 | 
                            No.1519 Diversity
                             | 
                    
| コンテスト | |
| ユーザー | 
                             oxyshower
                         | 
                    
| 提出日時 | 2021-05-30 12:03:03 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,302 bytes | 
| コンパイル時間 | 5,983 ms | 
| コンパイル使用メモリ | 173,892 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-08 20:43:23 | 
| 合計ジャッジ時間 | 6,450 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 3 WA * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "_DEBUG.hpp"
#endif
#define int long long
const long long inf = 2e18;
const int mod = 1e9 + 7;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}
template <class T>
vector<T> make_vec(size_t a) {
  return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
  t = v;
}
template <class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
  for (auto &e : t) fill(e, v);
}
signed main() {
  int n;
  cin >> n;
  vector<pair<int, int>> ans;
  vector<bool> used(n, false);
  vector<int> cnt(n, 0);
  int low = n - 1;
  for (int i = 0; i < n; i++) {
    used[i] = true;
    int pre = cnt[i];
    for (int j = 0; j < n; j++) {
      if (cnt[i] >= low) break;
      if (!used[j]) {
        ans.push_back({i + 1, j + 1});
        cnt[i]++;
        cnt[j]++;
      }
    }
    if (pre != cnt[i]) low--;
  }
  cout << ans.size() << endl;
  for (auto p : ans) {
    cout << p.first << " " << p.second << endl;
  }
  
  return 0;
}
            
            
            
        
            
oxyshower