Submission #1065204

# Submission time Handle Problem Language Result Execution time Memory
1065204 2024-08-19T03:11:39 Z pcc Soccer Stadium (IOI23_soccer) C++17
1.5 / 100
210 ms 39456 KB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fs first
#define sc second

const int mxn = 2022;

int N;
pii rng[mxn];

vector<pii> solve(vector<int> &row){
	vector<pii> v;
	for(int i = 0;i<N;i++){
		if(!row[i]){
			if(v.empty()||v.back().sc+1 != i)v.push_back(pii(i,i));
			else v.back().sc++;
		}
	}
	return v;
}

bool check(vector<vector<int>> &F){
	for(int i = 0;i<N;i++)rng[i] = pii(-1,-1);
	for(int i = 0;i<N;i++){
		vector<pii> v;
		v = solve(F[i]);
		if(v.size()>1)return 0;
		if(v.size()==1)rng[i] = v[0];
		else rng[i] = pii(N,-1);
	}
	pii now = pii(N,N);int mx = -1;
	for(int i = 0;i<N;i++){
		if(now.fs > rng[i].fs){
			mx = i;
			now = rng[i];
		}
		else if(now.fs == rng[i].fs&&now.sc<=rng[i].sc){
			mx = i;
			now = rng[i];
		}
	}
	for(int i = 0;i<N;i++)cerr<<rng[i].fs<<','<<rng[i].sc<<endl;
	cerr<<"MX = "<<mx<<endl;
	for(int i = mx-1;i>=0;i--){
		pii pre = rng[i+1],now = rng[i];
		if(pre.fs == N&&now.fs != N)return false;
		if(pre.fs>now.fs||pre.sc<now.sc)return false;
	}
	for(int i = mx+1;i<N;i++){
		pii pre = rng[i-1],now = rng[i];
		if(pre.fs == N&&now.fs != N)return false;
		if(pre.fs>now.fs||pre.sc<now.sc)return false;
	}
	return true;
}

int biggest_stadium(int NN, std::vector<std::vector<int>> F){
	N = NN;
	int cnt = 0;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<N;j++)F[i][j],cnt += !F[i][j];
	}
	if(cnt == N*N)return cnt;
	if(F[0][0] == 1||F[N-1][N-1] == 1||F[0][N-1] == 1||F[N-1][0] == 1)return cnt;
	return 0;
	if(!check(F))return false;
	cerr<<"ROW PASS!"<<endl;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<i;j++)swap(F[i][j],F[j][i]);
	}
	if(!check(F))return false;
	cerr<<"COL PASS!"<<endl;
	return cnt;
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 12 ms 2908 KB partial
9 Partially correct 210 ms 39456 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 0 ms 348 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Incorrect 0 ms 348 KB wrong
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 12 ms 2908 KB partial
10 Partially correct 210 ms 39456 KB partial
11 Incorrect 0 ms 348 KB wrong
12 Halted 0 ms 0 KB -