結果

問題 No.1949 足し算するだけのパズルゲーム(2)
ユーザー くまくま
提出日時 2022-06-07 17:46:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,873 bytes
コンパイル時間 1,958 ms
コンパイル使用メモリ 203,048 KB
最終ジャッジ日時 2024-11-15 02:18:42
合計ジャッジ時間 2,607 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In instantiation of 'void in(T& ...) [with T = {std::vector<std::vector<long long int, std::allocator<long long int> >, std::allocator<std::vector<long long int, std::allocator<long long int> > > >}]':
main.cpp:51:5:   required from here
main.cpp:30:55: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::vector<long long int>, std::allocator<std::vector<long long int> > >')
   30 | template<class... T>void in(T&... a) { (cin >> ... >> a); }
      |                                        ~~~~~~~~~~~~~~~^~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:120:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  120 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:120:36: note:   no known conversion for argument 1 from 'std::vector<std::vector<long long int>, std::allocator<std::vector<long long int> > >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
  120 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cel

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
const int INF = 1e9;
const ll LINF = 1e18;
const double eps = 1e-10;
#define fi first
#define se second
#define eb emplace_back
#define rep(i,n) for(ll i = 0; i < (ll)(n); ++i)
#define srep(i, s, n) for (ll i = s; i < (ll)(n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fore(i,x) for(auto &i:x)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define sz(x) (ll)x.size()
#define dame { puts("-1"); return;}
#define yes { puts("Yes"); return;}
#define no { puts("No"); return;}
#define ret(x) { cout<<(x)<<'\n'; return;}
bool is_pop(ll hash, ll d){return (hash>>d)&1;}
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
template<typename T> using PQ = priority_queue<T,vc<T>,greater<T>>;
template<class... T>void in(T&... a) { (cin >> ... >> a); }
void out() { cout << '\n'; }
template<class T, class... Ts>void out(const T& a, const Ts&... b) { cout << a;(cout << ... << (cout << ' ', b));cout << '\n'; }
template< typename T >istream &operator>>(istream &is, vector< T > &v){for(T &in : v) is >> in;return is;}
template< typename T >ostream &operator<<(ostream &os, const vector< T > &v){for(int i = 0; i < (int) v.size(); i++) {os << v[i] << (i + 1 != (int) v.size() ? " " : "");}return os;}
template<class... T>constexpr auto min(T... a) { return min(initializer_list<common_type_t<T...>>{a...}); }
template<class... T>constexpr auto max(T... a) { return max(initializer_list<common_type_t<T...>>{a...}); }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void MAIN(); int main() { cin.tie(0); ios::sync_with_stdio(false); MAIN(); }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};

void MAIN()
{
  ll h,w,x,y;
  in(h,w,x,y);
  x--; y--;
  vv<ll> a(h,vl(w));
  in(a);
  ll now = a[x][y];
  PQ<tuple<ll,ll,ll>> q;
  vv<bool> used(h,vc<bool>(w));
  used[x][y] = true;
  rep(i,4) {
    ll nx = x + di[i], ny = y + dj[i];
    if(nx<0||nx>=h||ny<0||ny>=w) continue;
    used[nx][ny] = true;
    q.emplace(a[nx][ny],nx,ny);
  }
  while(sz(q)) {
    auto [po,sx,sy] = q.top();
    if(po >= now) break;
    q.pop();
    now += po;
    x = sx; y = sy;
    rep(i,4) {
      ll nx = x + di[i], ny = y + dj[i];
      if(nx<0||nx>=h||ny<0||ny>=w) continue;
      if(used[nx][ny]) continue;
      used[nx][ny] = true;
      q.emplace(a[nx][ny],nx,ny);
    }
  }
  if(sz(q)) no
  else yes
}
0