code festival 2014 上海

Submission #596432

Source codeソースコード

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int MAXN = 1010;
char str[MAXN][MAXN];
bool used[MAXN][MAXN];
int num[MAXN][MAXN];
int Move[][2] = {{0,1}, {0,-1}, {-1,0}, {1,0}};

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n;
	while(scanf("%d",&n) == 1) {
		for (int i = 0;i < n;i++)scanf("%s", str[i]);
		memset(num , 0, sizeof(num));
		memset(used, false, sizeof(used));
		queue<pair<int,int> >q;
		q.push(make_pair(n-1,n-1));
		used[n-1][n-1] = true;
		while (!q.empty()) {
			pair<int,int>tmp = q.front();
			q.pop();
			int x = tmp.first;
			int y = tmp.second;
			for (int i = 0;i < 4;i++) {
				int nx = x + Move[i][0];
				int ny = y + Move[i][1];
				if (nx < 0 || nx >= n)continue;
				if (ny < 0 || ny >= n)continue;
				if (used[nx][ny])continue;
				if (str[x][y] == '#' || ++num[nx][ny] > 1) {
					used[nx][ny] = true;
					q.push(make_pair(nx,ny));
				}
			}
		}
		if (used[0][0])puts("YES");
		else puts("NO");
	}
    return 0;
}

Submission

Task問題 I - Obstruction
User nameユーザ名 102_kuangbin
Created time投稿日時
Language言語 C++ (G++ 4.6.4)
Status状態 AC
Score得点 100
Source lengthソースコード長 1249 Byte
File nameファイル名
Exec time実行時間 96 ms
Memory usageメモリ使用量 6756 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:47: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 100 / 100 manual_j1.txt,manual_j10.txt,manual_j11.txt,manual_j12.txt,manual_j13.txt,manual_j14.txt,manual_j15.txt,manual_j16.txt,manual_j17.txt,manual_j18.txt,manual_j19.txt,manual_j2.txt,manual_j20.txt,manual_j21.txt,manual_j22.txt,manual_j23.txt,manual_j24.txt,manual_j25.txt,manual_j26.txt,manual_j27.txt,manual_j28.txt,manual_j29.txt,manual_j3.txt,manual_j30.txt,manual_j31.txt,manual_j32.txt,manual_j33.txt,manual_j34.txt,manual_j4.txt,manual_j5.txt,manual_j6.txt,manual_j7.txt,manual_j8.txt,manual_j9.txt,random_01.txt,random_02.txt,random_03.txt,random_04.txt,random_05.txt,random_06.txt,random_07.txt,random_08.txt,random_09.txt,random_10.txt,random_11.txt,random_12.txt,random_13.txt,random_14.txt,random_15.txt,random_16.txt,random_17.txt,random_18.txt,random_19.txt,random_20.txt,scale_01.txt,scale_02.txt,scale_03.txt,scale_04.txt,scale_05.txt,scale_small_01.txt,scale_small_02.txt,scale_small_03.txt,scale_small_04.txt,scale_small_05.txt,scale_small_06.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
manual_j1.txt AC 58 ms 5804 KB
manual_j10.txt AC 35 ms 5868 KB
manual_j11.txt AC 34 ms 5856 KB
manual_j12.txt AC 35 ms 5864 KB
manual_j13.txt AC 34 ms 5856 KB
manual_j14.txt AC 34 ms 5740 KB
manual_j15.txt AC 35 ms 5748 KB
manual_j16.txt AC 37 ms 5864 KB
manual_j17.txt AC 35 ms 5864 KB
manual_j18.txt AC 35 ms 5864 KB
manual_j19.txt AC 34 ms 5852 KB
manual_j2.txt AC 35 ms 5748 KB
manual_j20.txt AC 34 ms 5744 KB
manual_j21.txt AC 35 ms 5748 KB
manual_j22.txt AC 35 ms 5868 KB
manual_j23.txt AC 34 ms 5740 KB
manual_j24.txt AC 34 ms 5788 KB
manual_j25.txt AC 35 ms 5744 KB
manual_j26.txt AC 35 ms 5744 KB
manual_j27.txt AC 34 ms 5740 KB
manual_j28.txt AC 34 ms 5852 KB
manual_j29.txt AC 34 ms 5744 KB
manual_j3.txt AC 38 ms 5908 KB
manual_j30.txt AC 35 ms 5788 KB
manual_j31.txt AC 35 ms 5788 KB
manual_j32.txt AC 35 ms 5748 KB
manual_j33.txt AC 36 ms 5736 KB
manual_j34.txt AC 35 ms 5744 KB
manual_j4.txt AC 35 ms 5740 KB
manual_j5.txt AC 37 ms 5828 KB
manual_j6.txt AC 36 ms 5736 KB
manual_j7.txt AC 35 ms 5872 KB
manual_j8.txt AC 35 ms 5740 KB
manual_j9.txt AC 35 ms 5744 KB
random_01.txt AC 34 ms 5872 KB
random_02.txt AC 33 ms 5988 KB
random_03.txt AC 35 ms 6120 KB
random_04.txt AC 35 ms 6120 KB
random_05.txt AC 36 ms 6248 KB
random_06.txt AC 38 ms 6376 KB
random_07.txt AC 38 ms 6504 KB
random_08.txt AC 39 ms 6632 KB
random_09.txt AC 40 ms 6628 KB
random_10.txt AC 96 ms 6756 KB
random_11.txt AC 35 ms 5856 KB
random_12.txt AC 36 ms 6048 KB
random_13.txt AC 40 ms 6116 KB
random_14.txt AC 44 ms 6248 KB
random_15.txt AC 48 ms 6248 KB
random_16.txt AC 55 ms 6384 KB
random_17.txt AC 60 ms 6496 KB
random_18.txt AC 67 ms 6624 KB
random_19.txt AC 77 ms 6636 KB
random_20.txt AC 92 ms 6724 KB
sample_01.txt AC 38 ms 5800 KB
sample_02.txt AC 39 ms 5832 KB
sample_03.txt AC 36 ms 5848 KB
scale_01.txt AC 71 ms 6756 KB
scale_02.txt AC 68 ms 6756 KB
scale_03.txt AC 50 ms 6740 KB
scale_04.txt AC 78 ms 6756 KB
scale_05.txt AC 54 ms 6756 KB
scale_small_01.txt AC 40 ms 6128 KB
scale_small_02.txt AC 43 ms 6168 KB
scale_small_03.txt AC 41 ms 6124 KB
scale_small_04.txt AC 38 ms 6120 KB
scale_small_05.txt AC 40 ms 6124 KB
scale_small_06.txt AC 41 ms 6060 KB