結果
| 問題 |
No.1949 足し算するだけのパズルゲーム(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-07 17:46:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,873 bytes |
| コンパイル時間 | 1,893 ms |
| コンパイル使用メモリ | 196,148 KB |
| 最終ジャッジ日時 | 2025-01-29 18:52:58 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、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 /usr/include/c++/13/sstream:40,
from /usr/include/c++/13/complex:45,
from /usr/include/c++/13/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
from main.cpp:1:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’
325 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/13/istream:325:25: note: no known conversion for argument 1 from ‘std::vector<std::vector<long long int>, std::allocator<std::vector<long long int> > >’ to ‘void*&’
325 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/13/istream:224:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’
224 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/13/istream:224:31: note: no known conversion for argument 1 from ‘std::vector<std::vector<long long int>, std::allocator<std::vector<long long int> > >’ to ‘long d
ソースコード
#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
}