結果
| 問題 | 
                            No.2708 Jewel holder
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-04-05 21:14:17 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 2,247 bytes | 
| コンパイル時間 | 1,234 ms | 
| コンパイル使用メモリ | 101,668 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-01 01:30:14 | 
| 合計ジャッジ時間 | 1,737 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
コンパイルメッセージ
main.cpp: In function 'void dfs(int, int, int)':
main.cpp:68:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   68 |     for(auto [di, dj] : vector<pair<int, int>>{{1, 0}, {0, 1}}) {
      |              ^
            
            ソースコード
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for(i = 0; i < n; ++i)
#define inc_rep(i, a, n) for(i = a; i <= n; ++i)
#define dec_rep(i, n, a) for(i = n; i >= a; --i)
#define in(a) cin >> a
#define out(a, b) cout << a << b
#define print_vec(v)                              \
    for(auto it = v.begin(); it != v.end(); ++it) \
        cout << *it << " ";                       \
    cout << endl
#define print_vec2d(v)                       \
    for(int i = 0; i < v.size(); ++i) {      \
        for(int j = 0; j < v[i].size(); ++j) \
            cout << v[i][j] << " ";          \
        cout << endl;                        \
    }                                        \
    cout << endl
#define print_vecpair(v)              \
    for(int i = 0; i < v.size(); ++i) \
    cout << v[i].first << " " << v[i].second << endl
#define vin(v)                        \
    for(int i = 0; i < v.size(); ++i) \
    cin >> v[i]
#define v2din(v)                             \
    for(int i = 0; i < v.size(); ++i) {      \
        for(int j = 0; j < v[i].size(); ++j) \
            cin >> v[i][j];                  \
    }
#define vpairin(v)                      \
    for(int i = 0; i < v.size(); ++i) { \
        int a, b;                       \
        cin >> a >> b;                  \
        v[i] = make_pair(a, b);         \
    }
using namespace std;
using lint = long long;
using ull = unsigned long long;
int cnt = 0;
int h, w;
vector<string> vs;
void dfs(int i, int j, int jwl) {
    if(vs[i][j] == 'o') { jwl++; }
    else if(vs[i][j] == 'x') {
        jwl--;
        if(jwl < 0) { return; }
    }
    if(i == h - 1 && j == w - 1 && jwl >= 0) {
        cnt++;
        return;
    }
    for(auto [di, dj] : vector<pair<int, int>>{{1, 0}, {0, 1}}) {
        int ni = i + di, nj = j + dj;
        if(ni < h && nj < w && vs[ni][nj] != '#') {
            dfs(ni, nj, jwl);
        }
    }
    return;
}
int main(void) {
    cin >> h >> w;
    vs.resize(h);
    vin(vs);
    dfs(0, 0, 0);
    cout << cnt << "\n";
    return 0;
}