結果

問題 No.1727 [Cherry 3rd Tune] Stray
ユーザー cureskolcureskol
提出日時 2021-10-29 22:49:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 6,000 ms
コード長 756 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 173,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 15:35:51
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
6,944 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 AC 20 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()

int t,n,c,ans;

int rev(int S){
  int res=0;
  REP(_,n){
    res=(res<<1)+(S&1);
    S>>=1;
  }
  return res;
}

bool ok(int S){
  int T=S;
  REP(_,2){
    REP(__,n){
      int U=T&((1<<n)-1);
      int D=T>>n;
      U=(U>>1)+((U&1)<<(n-1));
      D=(D>>1)+((D&1)<<(n-1));
      T=U+(D<<n);
      if(T<S)return false;
    }
    int U=T&((1<<n)-1);
    int D=T>>n;
    U=rev(U);
    D=rev(D);
    T=(U<<n)+D;
  }
  return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  cin>>t>>n>>c;
  REP(S,1<<(n*2))ans+=ok(S);
  cout<<ans<<endl;
}
0