結果

問題 No.5025 Forest Fire
コンテスト
ユーザー Jinapetto
提出日時 2026-10-24 15:15:35
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
+ 154µs
コード長 3,306 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,654 ms
コンパイル使用メモリ 366,852 KB
実行使用メモリ 9,928 KB
スコア 148,596,922
最終ジャッジ日時 2026-10-24 15:16:41
合計ジャッジ時間 58,540 ms
ジャッジサーバーID
(参考情報)
judge1_0 / <nil>
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vvvvi = vector<vector<vector<vector<int>>>>;
using vvl = vector<vector<long long>>;
using vvvl = vector<vector<vector<long long>>>;
using vvvvl = vector<vector<vector<vector<long long>>>>;
using vvc = vector<vector<char>>;
using vvb = vector<vector<bool>>;
using vvvb = vector<vector<vector<bool>>>;
using vvvvb = vector<vector<vector<vector<bool>>>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

struct Timer{
    chrono::steady_clock::time_point st;
    Timer(){
        st = chrono::steady_clock::now();
    }
    // 2sec -> 7e7 times
    inline double get(){
        return chrono::duration<double>(chrono::steady_clock::now() - st).count();
    }
} tim;

struct XorShift{
    using result_type = uint32_t;
    uint64_t x = 2003082720030827ull;
    inline uint32_t operator()(){
        x^=x<<7;
        x^=x>>9;
        return (uint32_t)x; 
    }
    // [0, m)
    inline uint32_t i(uint32_t m){
        return m ? (uint32_t)((uint64_t)(*this)()*m >> 32) : (*this)();
    }
    // [0.0, 1.0)
    inline double d(){
        return (double)((*this)() & 0xFFFFFF) / 16777216.0;
    }
    static constexpr uint32_t min() { return 0; }
    static constexpr uint32_t max() { return UINT32_MAX; }
} rnd;

// 2sec -> 1e9 times
inline bool ac(double start_time, double cur_time, double end_time, double score_dist, double start_temp, double end_temp){
    double temp = start_temp + (end_temp - start_temp) * (cur_time - start_time) / (end_time - start_time);
    // double temp = start_temp * pow(end_temp / start_temp, (cur_time - start_time) / (end_time - start_time)); // end_temp = 0 とすると常に temp = 0
    if(score_dist >= 0.0) return true;
    if(score_dist <= -8.0 * temp) return false;
    return rnd.d() < exp(score_dist/temp);
}

// 2sec -> 7e8 times
inline double mn_ac(double start_time, double cur_time, double end_time, double start_temp, double end_temp){
    double temp = start_temp + (end_temp - start_temp) * (cur_time - start_time) / (end_time - start_time);
    // double temp = start_temp * pow(end_temp / start_temp, (cur_time - start_time) / (end_time - start_time)); // end_temp = 0 とすると常に temp = 0
    return log(rnd.d()) * temp;
}

const int n = 50, k = 100;
uint8_t d[n][n];

void input(){
    int tmp;
    cin >> tmp >> tmp;
    rep(i,n){
        string s;
        cin >> s;
        rep(j,n) d[i][j] = s[j] - '0';
    }
}

vector<pair<int,int>> greedy(){
    vector<pair<int,int>> ans;
    rep(x,n)if(d[x][25] != 0) ans.push_back({x, 25});
    rep(y,n)if(y != 25 && d[25][y] != 0) ans.push_back({25, y});
    return ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    input();
    vector<pair<int,int>> ans = greedy();
    
    cout << ans.size() << '\n';
    for(auto [x, y] : ans) cout << x << ' ' << y << '\n';
    return 0;
}
0