結果

問題 No.420 mod2漸化式
ユーザー motimoti
提出日時 2016-09-09 23:23:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 7,737 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 166,268 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-11-16 18:39:52
合計ジャッジ時間 2,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
10,496 KB
testcase_01 AC 6 ms
10,368 KB
testcase_02 AC 7 ms
10,624 KB
testcase_03 AC 6 ms
10,496 KB
testcase_04 AC 6 ms
10,368 KB
testcase_05 AC 6 ms
10,496 KB
testcase_06 AC 6 ms
10,496 KB
testcase_07 AC 6 ms
10,496 KB
testcase_08 AC 7 ms
10,368 KB
testcase_09 AC 7 ms
10,496 KB
testcase_10 AC 7 ms
10,496 KB
testcase_11 AC 6 ms
10,496 KB
testcase_12 AC 7 ms
10,496 KB
testcase_13 AC 6 ms
10,496 KB
testcase_14 AC 6 ms
10,496 KB
testcase_15 AC 7 ms
10,496 KB
testcase_16 AC 7 ms
10,496 KB
testcase_17 AC 6 ms
10,496 KB
testcase_18 AC 6 ms
10,496 KB
testcase_19 AC 7 ms
10,496 KB
testcase_20 AC 6 ms
10,368 KB
testcase_21 AC 6 ms
10,368 KB
testcase_22 AC 6 ms
10,496 KB
testcase_23 AC 6 ms
10,496 KB
testcase_24 AC 6 ms
10,496 KB
testcase_25 AC 7 ms
10,496 KB
testcase_26 AC 6 ms
10,496 KB
testcase_27 AC 6 ms
10,496 KB
testcase_28 AC 7 ms
10,368 KB
testcase_29 AC 6 ms
10,496 KB
testcase_30 AC 6 ms
10,496 KB
testcase_31 AC 7 ms
10,496 KB
testcase_32 AC 7 ms
10,496 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

constexpr int MOD = 1e9+7;

namespace math {

constexpr int MaxComb = 1010;

struct Combination {

  long long comb_[MaxComb][MaxComb];
    
  Combination() {
    rep(i, MaxComb) {
      comb_[i][0] = 1;
      REP(j, 1, i+1) {
        comb_[i][j] = comb_[i-1][j-1] + comb_[i-1][j];
        comb_[i][j] %= MOD;
      }
    }
  }

  long long comb(int n, int r) const { return comb_[n][r]; }

};

}

math::Combination cb;

int main() {
/*
  ll sum = 0;
  rep(a, 31) {
    sum += 1LL<<a;
  }
  cout << sum << endl;
  
  sum = 0;
  rep(a, 31) REP(b, a+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
  }
  cout << sum << endl;


  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) REP(m, l+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
    sum += 1LL<<m;
  }
  cout << sum << endl;


  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) REP(m, l+1, 31) REP(n, m+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
    sum += 1LL<<m;
    sum += 1LL<<n;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) REP(m, l+1, 31) REP(n, m+1, 31) REP(o, n+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
    sum += 1LL<<m;
    sum += 1LL<<n;
    sum += 1LL<<o;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) REP(m, l+1, 31) REP(n, m+1, 31) REP(o, n+1, 31) REP(p, o+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
    sum += 1LL<<m;
    sum += 1LL<<n;
    sum += 1LL<<o;
    sum += 1LL<<p;
  }
  cout << sum << endl;

  sum = 0;
  rep(a, 31) REP(b, a+1, 31) REP(c, b+1, 31) REP(d, c+1, 31) REP(e, d+1, 31) REP(f, e+1, 31) REP(g, f+1, 31) REP(h, g+1, 31)
  REP(i, h+1, 31) REP(j, i+1, 31) REP(k, j+1, 31) REP(l, k+1, 31) REP(m, l+1, 31) REP(n, m+1, 31) REP(o, n+1, 31) REP(p, o+1, 31)
  REP(q, p+1, 31) {
    sum += 1LL<<a;
    sum += 1LL<<b;
    sum += 1LL<<c;
    sum += 1LL<<d;
    sum += 1LL<<e;
    sum += 1LL<<f;
    sum += 1LL<<g;
    sum += 1LL<<h;
    sum += 1LL<<i;
    sum += 1LL<<j;
    sum += 1LL<<k;
    sum += 1LL<<l;
    sum += 1LL<<m;
    sum += 1LL<<n;
    sum += 1LL<<o;
    sum += 1LL<<p;
    sum += 1LL<<q;
  }
  cout << sum << endl;


  cout << "----------------------------------------------" << endl;
  cout << endl;
*/
  ll ans[32] = {
    2147483647,
64424509410,
934155386445,
8718783606820,
58851789346035,
306029304599382,
1275122102497425,
4371847208562600,
12569060724617475,
30724370660176050,
64521178386369705,
117311233429763100,
185742786263791575,
257182319442172950,
312292816465495725,
333112337563195440,
  };

  for(int i=0; i<16; i++) {
    ans[30-i] = ans[i];
  }

//  rep(i, 32) cout << ans[i] << endl;

  // 31ビット中, 1が立つ組み合わせの数
  int x; cin >> x;
  if(x == 0) {
    cout << 1 << " " << 0 << endl;
  }
  else if(x > 31)
    cout << 0 << endl;
  else {
    cout << cb.comb(31, x) << " " << ans[x-1] << endl;
  }

  return 0;
}
0