東京大学プログラミングコンテスト2014

Submission #3487965

Source codeソースコード

#include<iostream>
#include<algorithm>
using namespace std;
int n,m,b[10000][10000],total,x[4]={0,1,0,-1},y[4]={1,0,-1,0},maxx;
int dfs(int,int);
int main()
{
	cin>>n>>m;
    for(int i=1;i<=n;++i)
      for(int j=1;j<=m;++j)
        cin>>b[i][j];
    dfs(1,1);
    cout<<maxx;
    return 0;
}
int dfs(int k,int p)
{
	for(int i=0;i<=3;++i)
	{
		if(b[k][p]==1 && k+x[i]>=1&&k+x[i]<=n&&p+y[i]>=1&&p+y[i]<=m) 
		{
			total=0;
			dfs(k+x[i],p+y[i]);	
		}
		else
		{
			total++;
			if(total>maxx) maxx=total;
			b[k][p]=0;
			if(k+x[i]>=1&&k+x[i]<=n&&p+y[i]>=1&&p+y[i]<=m) dfs(k+x[i],p+y[i]);
		}
	}
}

Submission

Task問題 C - 最小カットと最大カット
User nameユーザ名 luogu_bot4
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 627 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 scrambled_00.txt,scrambled_01.txt,scrambled_02.txt,scrambled_03.txt,scrambled_04.txt,scrambled_05.txt,scrambled_06.txt,scrambled_07.txt,scrambled_08.txt,scrambled_09.txt,scrambled_10.txt,scrambled_11.txt,scrambled_12.txt,scrambled_13.txt,scrambled_14.txt,scrambled_15.txt,scrambled_16.txt,scrambled_17.txt,scrambled_18.txt,scrambled_19.txt,scrambled_20.txt,scrambled_21.txt,scrambled_22.txt,scrambled_23.txt,scrambled_24.txt,scrambled_25.txt,scrambled_26.txt,scrambled_27.txt,scrambled_28.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
scrambled_00.txt RE
scrambled_01.txt RE
scrambled_02.txt RE
scrambled_03.txt TLE
scrambled_04.txt TLE
scrambled_05.txt TLE
scrambled_06.txt TLE
scrambled_07.txt TLE
scrambled_08.txt TLE
scrambled_09.txt RE
scrambled_10.txt TLE
scrambled_11.txt TLE
scrambled_12.txt TLE
scrambled_13.txt TLE
scrambled_14.txt TLE
scrambled_15.txt TLE
scrambled_16.txt TLE
scrambled_17.txt TLE
scrambled_18.txt TLE
scrambled_19.txt RE
scrambled_20.txt TLE
scrambled_21.txt TLE
scrambled_22.txt TLE
scrambled_23.txt TLE
scrambled_24.txt TLE
scrambled_25.txt TLE
scrambled_26.txt TLE
scrambled_27.txt TLE
scrambled_28.txt TLE