結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
shin3110
|
| 提出日時 | 2024-03-31 13:43:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,131 bytes |
| コンパイル時間 | 3,423 ms |
| コンパイル使用メモリ | 235,568 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-30 18:17:33 |
| 合計ジャッジ時間 | 4,015 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 2 |
ソースコード
/*
∧∧∩
( ゚∀゚)/ キタ━━━━━━(゚∀゚)━━━━━━!!!!
⊂ ノ ゆっくり見てってね!!!!!!!!
(つ ノ
o (ノ
\ ☆
| o
(⌒ ⌒ヽ / ☆
\ (´⌒ ⌒ ⌒ヾ /
('⌒ ; ⌒ ::⌒ )
(´ ) ::: ) /
☆─ (´⌒;: ::⌒`) :; )
*/
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, s, n) for(int i=s; i<n; i++)
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef long double ld;
ld pi = 3.14159265358979;
// bool型に対して"Yes", "No" を出力する
bool printb(bool f) {if (f) cout << "Yes\n";else cout << "No\n";return f;}
//vectorのcout,cin
template<typename T>
std::istream &operator>>(std::istream&is,std::vector<T>&v){for(T &in:v){is>>in;}return is;}
template<typename T>
std::ostream &operator<<(std::ostream&os,const std::vector<T>&v){for(auto it=std::begin(v);it!=std::end(v);){os<<*it<<((++it)!=std::end(v)?" ":"");}return os;}
// 回文かどうかの判定
bool iskaibun(string s){ll k = s.size();rep(i,0,k/2){if(s[i]!=s[k-1-i]){return false;}}return true;}
template<class T> void chmax(T& a, T b) { if (a < b) a = b; }
template<class T> void chmin(T& a, T b) { if (a > b) a = b; }
// 余りが正になるような割り方
ll floor(ll x, ll m) {
ll r = (x % m + m) % m;
return (x - r) / m;
}
#define mod 998244353
using mint = modint998244353;
int op(int a, int b) {return max(a, b);}
int e() {return 0;}
int mapping(int f, int x) {return (f == 1e9 ? x : f);}
int composition(int f, int g) {return (f == 1e9 ? g : f);}
int id() {return 1e9;}
signed main() {
cin.tie(nullptr);
cout << fixed << setprecision(10);
ios::sync_with_stdio(false);
int h, w;cin >> h >> w;
vector<string> a(h);
rep(i, 0, h) cin >> a[i];
vector<vector<int>> s(h, vector<int>(w, 0));
rep(i, 0, h) rep(j, 0, w) {
if(a[i][j] == 'o') s[i][j] = 1;
if(a[i][j] == 'x') s[i][j] = -1;
}
queue<vector<int>> q;
q.push({0, 0, 1});
vector<int> tx = {0, 1};
vector<int> ty = {1, 0};
int ans = 0;
while(!q.empty()) {
auto z = q.front(); q.pop();
int x = z[0], y = z[1], cnt = z[2];
//cout <<x << ' ' << y <<' ' << cnt << endl;
rep(i, 0, 2) {
int nx = x+ tx[i], ny = y + ty[i];
if(nx >= h || ny >= w) continue;
if(a[nx][ny] == '#') continue;
if(nx == h-1 && ny == w-1) {
ans++;
continue;
}
if(cnt+s[nx][ny] < 0) continue;
q.push({nx, ny, cnt+s[nx][ny]});
}
}
cout << ans << endl;
}
shin3110