結果
問題 | No.2708 Jewel holder |
ユーザー |
|
提出日時 | 2024-03-31 13:41:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 1,533 bytes |
コンパイル時間 | 1,927 ms |
コンパイル使用メモリ | 172,196 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 18:14:14 |
合計ジャッジ時間 | 2,427 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include "bits/stdc++.h" /* #include "boost/multiprecision/cpp_int.hpp" namespace mp = boost::multiprecision; using i128=mp::cpp_int; */ using namespace std; typedef long long ll; typedef int64_t i64; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vvll> vvvll; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<double> vd; typedef vector<vd> vvd; #define rep(i,a,n) for(int i=a;i<n;i++) #define drep(i,a,n) for(int i=a;i>n;i--) #define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl; #define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl; #define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl; #define iINF 1000000007 #define lINF 10000000000007 #define llINF 4000000000000000007 #define all(x) x.begin(),x.end() #define so(x) sort(all(x)) #define re(x) reverse(all(x)) const double PI = acos(-1); int main(){ int h,w; cin>>h>>w; vs d(h); rep(i,0,h) cin>>d[i]; vi now(h+w-2,1); rep(i,0,h-1) now[i]=0; int ans=0; do{ int x=0,y=0; int cnt=1; bool wh=1; rep(i,0,h+w-2){ if(now[i]==0) x++; else y++; if(d[x][y]=='#') wh=0; else if(d[x][y]=='o'){ cnt++; } else{ cnt--; if(cnt<0) wh=0; } } if(wh) ans++; }while(next_permutation(all(now))); cout<<ans<<endl; }