結果

問題 No.5006 Hidden Maze
ユーザー ぴぃいいいい
提出日時 2025-03-06 18:10:28
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 3,719 bytes
コンパイル時間 7,223 ms
コンパイル使用メモリ 351,560 KB
実行使用メモリ 25,960 KB
スコア 17,692
平均クエリ数 824.08
最終ジャッジ日時 2025-03-06 18:10:47
合計ジャッジ時間 18,543 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:105:23: warning: ‘void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]’ is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
  105 |         random_shuffle(all(outstr));
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from main.cpp:1:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
using mint = modint998244353;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define print(var) std::cout<<#var<<"="<<(var)<<std::endl
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vvvvll vector<vvvll>
#define vmi vector<mint>
#define vvmi vector<vmi>
#define vvvmi vector<vvmi>
#define vvvvmi vector<vvvmi>
#define vvvvvmi vector<vvvvmi>
#define vs vector<string>
#define pii pair<int,int>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define bit(x,i)(((x)>>(i))&1)
#define inf (1<<30)
#define INF (1ll<<60)
#define X first
#define Y second
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
template<class T, class F> T nibutan(T ok, T ng, const F &f){while(abs(ok-ng)>1){T mid = (ok+ng)/2;(f(mid)?ok:ng) = mid;}return ok;}
template<class T> vector<T> digit(T x){vector<T> res; while(x>0){res.push_back(x%10); x/=10;} return res;}
ostream& operator<<(ostream& os, const mint& x){ os << x.val(); return os; }
template<class T> istream &operator>>(istream &is, vector<T> &vec){ for(auto &v:vec) is >> v; return is; }
template<class T> void coutvector(vector<T> x){ for(int i=0;i<(int)x.size();i++){if(i>0) cout<<" ";cout<<x[i];}cout<<endl;}
using Set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
template<class S, class T> using Unordered_Map = gp_hash_table<S,T>;

#ifdef LOCAL
#include<dump.hpp>
CPP_DUMP_DEFINE_EXPORT_OBJECT(mint,val());
#else
#define cpp_dump
#endif

inline double get_time() {
    #ifdef ONLINE_JUDGE
    timeval tv; gettimeofday(&tv, NULL);
    return tv.tv_sec * 1e3 + tv.tv_usec * 1e-3;
    #else
    using namespace std::chrono;
    return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
    #endif
}
double start_time = get_time();
inline double elapsed(){ return get_time() - start_time; }

static uint32_t xor128(void){
    static uint32_t x=123456789,y=362436069,z=521288629,w=88675123;
    uint32_t t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}
inline int randrange(int a){return (uint64_t(xor128()) * a >> 32); }
inline int randrange(int a, int b){ return randrange(b-a)+a; }
inline double randDouble(double a,double b){return a+(b-a)*xor128()/(double)ULONG_MAX;}

const int H = 20, W = 20;
int P;
enum Dir{
    U,D,L,R
};
vpii around{{0,1},{1,0},{-1,0},{0,-1}};

vector<Dir> route2dir(const vpii &route){
    vector<Dir> res;
    for(int i=1;i<(int)route.size();i++){
        if(route[i-1].X==route[i].X){
            if(route[i-1].Y+1==route[i].Y) res.push_back(R);
            else if(route[i-1].Y-1==route[i].Y) res.push_back(L);
            else assert(false);
        }
        else if(route[i-1].Y==route[i].Y){
            if(route[i-1].X+1==route[i].X) res.push_back(D);
            else if(route[i-1].X-1==route[i].X) res.push_back(U);
            else assert(false);
        }
        else assert(false);
    }
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int hoge1,hoge2; cin>>hoge1>>hoge2;
    cin >> P;

    while(true){
        string outstr = string(19,'D') + string(19,'R');
        random_shuffle(all(outstr));
        cout << outstr << endl;

        int tmp; cin>>tmp;
        if(tmp==-1) exit(0);
    }
}
0