結果

問題 No.2700 Please Hack Greedy Solution!
ユーザー ripity
提出日時 2024-03-29 21:38:41
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 500 ms
コード長 595 bytes
コンパイル時間 6,240 ms
コンパイル使用メモリ 258,804 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-06 11:34:58
合計ジャッジ時間 6,313 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;

int main() {
  int W = 1000;
  const ll v_init = 3e5;
  vector<pair<ll, ll>> a;
  a.push_back(make_pair(1, 1));
  a.push_back(make_pair(v_init, 1));
  a.push_back(make_pair(v_init+2, 2));
  for(int i = 3; i <= W; i++) {
    int v = a.back().first+v_init+1;
    a.push_back(make_pair(v, i));
  }
  int N = a.size();
  // sort(a.begin(), a.end(), [&](auto l, auto r) {
  //   return l.first*r.second < l.second*r.first;
  // });
  cout << N << " " << W << endl;
  for(auto [v, w] : a) {
    cout << v << " " << w << endl;
  }
}
0