Contest Duration: - (local time) (90 minutes) Back to Home

Submission #34530

Source Code Expand

Copy
```#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <queue>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define rep(i, n) rep2(i, 0, n)
#define sz(v) v.size()
#define mk(x, y) make_pair(x, y)
#define fst first
#define scd second
#define X fst
#define Y scd
#define MEMSET(x, n) memset(x, n, sizeof(x))
#define MEMZERO(x) MEMSET(x, 0)
#define URU(y) (!(y % 4) && y % 100 || !(y % 400))

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

string s[1001];

int dx[] = { 0, 0, -1, 1, -1, -1, 1, 1 };
int dy[] = { -1, 1, 0, 0, -1, 1, -1, 1 };

int main( void )
{
int h, w;
while(cin >> h >> w) {
rep(i, h) cin >> s[i];
int a, b, c;
a = b = c = 0;
rep(y, h) rep(x, w) {
if(s[y][x] == 'o') {
queue<pii> q;
q.push(mk(x, y));
s[y][x] = '.';
int cnt = 0;
while(!q.empty()) {
pii p = q.front(); q.pop();
++cnt;
rep(d, 8) {
int xx = p.X + dx[d], yy = p.Y + dy[d];
if(0 <= xx && xx < w && 0 <= yy && yy < h
&& s[yy][xx] == 'o'
) {
s[yy][xx] = '.';
q.push(mk(xx, yy));
}
}
}
if(cnt % 12 == 0)
++a;
else if(cnt % 11 == 0)
++c;
else
++b;
}
}
cout << a << ' ' << b << ' ' << c << endl;
}
return 0;
}```

#### Submission Info

Submission Time 2012-07-21 23:20:08+0900 D - アルファベット探し kkk C++ (G++ 4.6.4) 0 1402 Byte WA 97 ms 1796 KB

#### Judge Result

Set Name All
Score / Max Score 0 / 100
Status
 AC × 29 WA × 29
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rndsmall_00.txt, 01_rndsmall_01.txt, 01_rndsmall_02.txt, 01_rndsmall_03.txt, 01_rndsmall_04.txt, 01_rndsmall_05.txt, 01_rndsmall_06.txt, 01_rndsmall_07.txt, 01_rndsmall_08.txt, 01_rndsmall_09.txt, 01_rndsmall_10.txt, 01_rndsmall_11.txt, 01_rndsmall_12.txt, 01_rndsmall_13.txt, 01_rndsmall_14.txt, 01_rndsmall_15.txt, 01_rndsmall_16.txt, 01_rndsmall_17.txt, 01_rndsmall_18.txt, 01_rndsmall_19.txt, 02_rndmax_00.txt, 02_rndmax_01.txt, 02_rndmax_02.txt, 02_rndmax_03.txt, 02_rndmax_04.txt, 02_rndmax_05.txt, 02_rndmax_06.txt, 02_rndmax_07.txt, 02_rndmax_08.txt, 02_rndmax_09.txt, 02_rndmax_10.txt, 02_rndmax_11.txt, 02_rndmax_12.txt, 02_rndmax_13.txt, 02_rndmax_14.txt, 02_rndmax_15.txt, 02_rndmax_16.txt, 02_rndmax_17.txt, 02_rndmax_18.txt, 02_rndmax_19.txt, 03_rnd_00.txt, 03_rnd_01.txt, 03_rnd_02.txt, 03_rnd_03.txt, 03_rnd_04.txt, 03_rnd_05.txt, 03_rnd_06.txt, 03_rnd_07.txt, 03_rnd_08.txt, 03_rnd_09.txt, 04_empty_00.txt, 05_maxret_00.txt
Case Name Status Exec Time Memory
00_min.txt AC 22 ms 784 KB
00_sample_01.txt AC 23 ms 792 KB
00_sample_02.txt AC 21 ms 788 KB
00_sample_03.txt AC 21 ms 788 KB
00_sample_04.txt AC 22 ms 788 KB
00_sample_05.txt AC 21 ms 740 KB
01_rndsmall_00.txt WA 25 ms 772 KB
01_rndsmall_01.txt AC 23 ms 748 KB
01_rndsmall_02.txt AC 22 ms 792 KB
01_rndsmall_03.txt WA 22 ms 792 KB
01_rndsmall_04.txt AC 23 ms 764 KB
01_rndsmall_05.txt AC 22 ms 788 KB
01_rndsmall_06.txt AC 22 ms 788 KB
01_rndsmall_07.txt AC 22 ms 792 KB
01_rndsmall_08.txt AC 22 ms 764 KB
01_rndsmall_09.txt AC 23 ms 736 KB
01_rndsmall_10.txt AC 22 ms 816 KB
01_rndsmall_11.txt WA 34 ms 784 KB
01_rndsmall_12.txt AC 23 ms 792 KB
01_rndsmall_13.txt AC 24 ms 780 KB
01_rndsmall_14.txt AC 22 ms 792 KB
01_rndsmall_15.txt WA 21 ms 740 KB
01_rndsmall_16.txt AC 23 ms 792 KB
01_rndsmall_17.txt AC 23 ms 780 KB
01_rndsmall_18.txt AC 22 ms 792 KB
01_rndsmall_19.txt AC 21 ms 796 KB
02_rndmax_00.txt WA 81 ms 1796 KB
02_rndmax_01.txt WA 83 ms 1796 KB
02_rndmax_02.txt WA 90 ms 1780 KB
02_rndmax_03.txt WA 85 ms 1788 KB
02_rndmax_04.txt WA 86 ms 1780 KB
02_rndmax_05.txt WA 84 ms 1784 KB
02_rndmax_06.txt AC 86 ms 1780 KB
02_rndmax_07.txt WA 85 ms 1784 KB
02_rndmax_08.txt WA 85 ms 1784 KB
02_rndmax_09.txt WA 81 ms 1780 KB
02_rndmax_10.txt WA 83 ms 1792 KB
02_rndmax_11.txt WA 83 ms 1792 KB
02_rndmax_12.txt WA 83 ms 1788 KB
02_rndmax_13.txt WA 85 ms 1780 KB
02_rndmax_14.txt AC 90 ms 1772 KB
02_rndmax_15.txt WA 86 ms 1776 KB
02_rndmax_16.txt WA 83 ms 1760 KB
02_rndmax_17.txt WA 82 ms 1788 KB
02_rndmax_18.txt WA 82 ms 1784 KB
02_rndmax_19.txt WA 84 ms 1792 KB
03_rnd_00.txt AC 23 ms 788 KB
03_rnd_01.txt WA 37 ms 1144 KB
03_rnd_02.txt AC 36 ms 1028 KB
03_rnd_03.txt WA 37 ms 1016 KB
03_rnd_04.txt WA 40 ms 1012 KB
03_rnd_05.txt AC 25 ms 908 KB
03_rnd_06.txt WA 49 ms 1372 KB
03_rnd_07.txt WA 30 ms 1080 KB
03_rnd_08.txt WA 57 ms 1788 KB
03_rnd_09.txt WA 48 ms 1392 KB
04_empty_00.txt AC 75 ms 1796 KB
05_maxret_00.txt AC 97 ms 1788 KB