結果
| 問題 | No.13 囲みたい! |
| コンテスト | |
| ユーザー |
togari_takamoto
|
| 提出日時 | 2015-12-14 02:04:58 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,218 bytes |
| 記録 | |
| コンパイル時間 | 697 ms |
| コンパイル使用メモリ | 111,536 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-04 19:38:42 |
| 合計ジャッジ時間 | 1,384 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 6 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:53,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In function 'void std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool*; _Tp = bool]',
inlined from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = bool*; _Tp = bool]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:979:21,
inlined from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool*; _Tp = bool]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:1011:20,
inlined from 'int main()' at main.cpp:47:6:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:925:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' writing 10201 bytes into a region of size 10000 overflows the destination [-Wstringop-overflow=]
925 | *__first = __val;
| ~~~~~~~~~^~~~~~~
main.cpp: In function 'int main()':
main.cpp:31:6: note: destination object 'visited' of size 10000
31 | bool visited[100][100];
| ^~~~~~~
In function 'void std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool*; _Tp = bool]',
inlined from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = bool*; _
ソースコード
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <iomanip>
#include <numeric>
#include <memory>
#include <set>
#include <cassert>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(ll i=0; i<(n); ++i)
#define TEN(x) ((ll)1e##x)
#define ALL(v) (v).begin(), (v).end()
// 0 1 2 3
ll dx[] = { 1, 0, 0, -1 };
ll dy[] = { 0, 1, -1, 0 };
ll m[100][100]; // m[h][w];
ll w, h;
bool visited[100][100];
bool is_inner(ll x, ll y) { return !(x < 0 || w <= x || y < 0 || h <= y); }
bool bfs(ll x, ll y, ll d) {
if (visited[y][x]) return true;
visited[y][x] = true;
REP(i, 4) if (i != d) if (is_inner(x + dx[i], y + dy[i])) if (m[y][x] == m[y + dy[i]][x + dx[i]]) {
if (bfs(x + dx[i], y + dy[i], 3 - i)) return true;
}
return false;
}
int main(){
cin >> w >> h;
REP(y, h) REP(x, w) cin >> m[y][x];
fill(visited[0], visited[0] + 101 * 101, false);
REP(y, h) REP(x, w) if (!visited[y][x]) if (bfs(x, y, -1)) {
cout << "possible" << endl;
return 0;
}
cout << "impossible" << endl;
return 0;
}
togari_takamoto