답안 #995776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995776 2024-06-09T22:44:18 Z aaaaaarroz 축구 경기장 (IOI23_soccer) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
bool limites(int N, int i, int j){
	return i>=0&&i<N&&j>=0&&j<N;
}
int biggest_stadium(int N, vector<vector<int>> F){
	int empty_cells=0;
	pair<int,int>arbol;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(F[i][j]==0){
				empty_cells++;
			}	
		}
	}
	bool si=true;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(F[i][j]==1){
				continue;
			}
			priority_queue<tuple<int,int,int>,vector<tuple<int,int,int>>,greater<tuple<int,int,int>>>cola;
			int dx[]={1,0,-1,0};
			int dy[]={0,1,0,-1};
			vector<vector<int>>dist(N,vector<int>(N,INT_MAX));
			dist[i][j]=0;
			cola.push({0,i,j});
			while(!cola.empty()){
				auto[d,x,y]=cola.top();
				cola.pop();
				for(int dir=0;dir<4;dir++){
					int posi=x+dx[dir];
					int posj=y+dy[dir];
					while(true){
						if(!limites(N,posi,posj)||F[posi][posj]==1)break;
						if((d+1)<dist[posi][posj]){
							dist[posi][posj]=d+1;
							cola.push({dist[posi][posj],posi,posj});
						}
						posi+=dx[dir];
						posj+=dy[dir];
					}
				}
			}
			for(int x=0;x<N;x++){
				for(int y=0;y<N;y++){
					if(F[x][y]==0&&(dist[x][y]>=3)){
						si=false;
					}
				}
			}
			if(si){
				return empty_cells;
			}
			else{
				return 1;
			}
		}
	}
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Incorrect 0 ms 348 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 1 ms 344 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 1 ms 344 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 1 ms 344 KB ok
6 Correct 0 ms 348 KB ok
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -