답안 #531718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531718 2022-03-01T10:21:42 Z errorgorn Sandcastle 2 (JOI22_ho_t5) C++17
15 / 100
5000 ms 1048580 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n,m;
int arr[1500][1500];
vector<ii> idx;

int dist(ii i,ii j){
	return abs(i.fi-j.fi)+abs(i.se-j.se);
}

signed main(){
	cin.tie(0);
	cout.tie(0);
	cin.sync_with_stdio(false);
	
	cin>>n>>m;
	rep(x,0,n) rep(y,0,m){
		cin>>arr[x][y];
		idx.pub({x,y});
	}
	
	sort(all(idx),[](ii i,ii j){
		return arr[i.fi][i.se]<arr[j.fi][j.se];
	});
	
	int ans=0;
	rep(x1,0,n) rep(x2,x1,n) rep(y1,0,m) rep(y2,y1,m){
		ii p={-1,-1};
		bool ok=true;
		
		for (auto it:idx) if (x1<=it.fi && it.fi<=x2 && y1<=it.se && it.se<=y2){
			if (p!=ii(-1,-1) && dist(it,p)>1){
				ok=false;
				break;
			}
			p=it;
		}
		
		if (ok) ans++;
	}
	
	cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 5042 ms 2132 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 3127 ms 6408 KB Output is correct
8 Correct 45 ms 6348 KB Output is correct
9 Correct 78 ms 524 KB Output is correct
10 Correct 1457 ms 596 KB Output is correct
11 Correct 2077 ms 388 KB Output is correct
12 Correct 2190 ms 3384 KB Output is correct
13 Correct 524 ms 540 KB Output is correct
14 Correct 179 ms 460 KB Output is correct
15 Correct 377 ms 596 KB Output is correct
16 Correct 98 ms 608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 3127 ms 6408 KB Output is correct
8 Correct 45 ms 6348 KB Output is correct
9 Correct 78 ms 524 KB Output is correct
10 Correct 1457 ms 596 KB Output is correct
11 Correct 2077 ms 388 KB Output is correct
12 Correct 2190 ms 3384 KB Output is correct
13 Correct 524 ms 540 KB Output is correct
14 Correct 179 ms 460 KB Output is correct
15 Correct 377 ms 596 KB Output is correct
16 Correct 98 ms 608 KB Output is correct
17 Runtime error 1204 ms 1048580 KB Execution killed with signal 9
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 3127 ms 6408 KB Output is correct
8 Correct 45 ms 6348 KB Output is correct
9 Correct 78 ms 524 KB Output is correct
10 Correct 1457 ms 596 KB Output is correct
11 Correct 2077 ms 388 KB Output is correct
12 Correct 2190 ms 3384 KB Output is correct
13 Correct 524 ms 540 KB Output is correct
14 Correct 179 ms 460 KB Output is correct
15 Correct 377 ms 596 KB Output is correct
16 Correct 98 ms 608 KB Output is correct
17 Runtime error 1204 ms 1048580 KB Execution killed with signal 9
18 Halted 0 ms 0 KB -