답안 #704439

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704439 2023-03-02T06:20:48 Z ld_minh4354 Sandcastle 2 (JOI22_ho_t5) C++17
10 / 100
5000 ms 18092 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define debug(x) cout<<#x<<": "<<x<<"\n"



signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//	freopen("input.000","r",stdin);
//	freopen("output.000","w",stdout);
//	srand((unsigned)time(NULL));
//	rand()
	
	int n,i,a[1505][1505],j,m,c,ans,l,r,u,d;
	pair<int,pair<int,int>> p[1505];
	bool tr;
	
	cin>>n>>m;
	for (i=1;i<n+1;i++) for (j=1;j<m+1;j++) cin>>a[i][j];
	
	ans=0;
	for (u=1;u<n+1;u++) for (d=u;d<n+1;d++)
	for (l=1;l<m+1;l++) for (r=l;r<m+1;r++)
	{
		c=0;tr=true;
		for (i=u;i<d+1;i++) for (j=l;j<r+1;j++)
		{
			c++;
			p[c]={a[i][j],{i,j}};
		}
		
		sort(p+1,p+c+1);
		for (i=1;i<c;i++)
		if (abs(p[i].se.fi - p[i+1].se.fi) + abs(p[i].se.se - p[i+1].se.se) != 1) tr=false;
		
		if (tr) ans++;
	}
	
	cout<<ans;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 18004 KB Output is correct
2 Execution timed out 5058 ms 18084 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 18004 KB Output is correct
2 Correct 9 ms 18036 KB Output is correct
3 Correct 8 ms 18036 KB Output is correct
4 Correct 9 ms 17984 KB Output is correct
5 Correct 10 ms 18072 KB Output is correct
6 Correct 9 ms 18004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 18004 KB Output is correct
2 Correct 9 ms 18036 KB Output is correct
3 Correct 8 ms 18036 KB Output is correct
4 Correct 9 ms 17984 KB Output is correct
5 Correct 10 ms 18072 KB Output is correct
6 Correct 9 ms 18004 KB Output is correct
7 Execution timed out 5071 ms 18092 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 18004 KB Output is correct
2 Correct 9 ms 18036 KB Output is correct
3 Correct 8 ms 18036 KB Output is correct
4 Correct 9 ms 17984 KB Output is correct
5 Correct 10 ms 18072 KB Output is correct
6 Correct 9 ms 18004 KB Output is correct
7 Execution timed out 5071 ms 18092 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 18004 KB Output is correct
2 Correct 9 ms 18036 KB Output is correct
3 Correct 8 ms 18036 KB Output is correct
4 Correct 9 ms 17984 KB Output is correct
5 Correct 10 ms 18072 KB Output is correct
6 Correct 9 ms 18004 KB Output is correct
7 Execution timed out 5071 ms 18092 KB Time limit exceeded
8 Halted 0 ms 0 KB -