結果
問題 |
No.1727 [Cherry 3rd Tune] Stray
|
ユーザー |
![]() |
提出日時 | 2021-10-29 22:49:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 6,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 1,988 ms |
コンパイル使用メモリ | 174,920 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 12:29:10 |
合計ジャッジ時間 | 2,548 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 |
ソースコード
#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; }