Submission #918814

# Submission time Handle Problem Language Result Execution time Memory
918814 2024-01-30T13:16:58 Z ErJ Soccer Stadium (IOI23_soccer) C++17
0 / 100
2 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<pair<ll, ll>>
#define pp pair<ll, ll>
#define qi queue<ll>
#define qp queue<pp>
#define pqi priority_queue<ll>
#define pqp priority_queue<pp>
#define mi map<ll, ll>
#define mpi map<pp, ll>
#define mip map<ll, pp>
#define mpp map<pp, pp>
#define mb map<ll, bool>
#define si set<ll>
#define sp set<pp>
#define mod 1000000007
#define rep(a, b) for(int a = 0; a < (b); a++)
#define inf 1000000000000000000

bool isOK(int n, vector<vector<int>> F) {
	vp okraje(n);
	for (int i = 0; i < n; i++) {
		int pocet = 0;
		for (int j = 1; j < n; j++) {
			if (F[i][j] != F[i][j - 1]) {
				pocet++;
			}
		}
		if (F[i][n - 1] == 0) pocet++;
		if (F[i][0] == 0) pocet++;

		if (pocet > 2) {
			return 0;
		}
		okraje[i] = { -1, -1 };
		for (int j = 0; j < n; j++) {
			if (F[i][j] == 0) {
				okraje[i].first = j;
				break;
			}
		}
		for (int j = n - 1; j >= 0; j--) {
			if (F[i][j] == 0) {
				okraje[i].first = j;
				break;
			}
		}
	}
	for (int i = 0; i < okraje.size(); i++) {
		for (int j = 0; j < okraje.size(); j++) {
			if (!((okraje[i].first <= okraje[j].first && okraje[i].second >= okraje[j].second) || ((okraje[j].first <= okraje[i].first && okraje[j].second >= okraje[i].second)))) {
				return 0;
			}
		}
	}
}

int biggest_stadium(int n, vector<vector<int>> F) {
	vector<vector<int>> FT(n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		FT[i].resize(n);
		for (int j = 0; j < n; j++) {
			if (F[i][j] == 0) ans++;
			FT[i][j] = F[j][i];
		}
	}
	if (isOK(n, F) && isOK(n, FT)) {
		return ans;
	}
	else {
		return 0;
	}
}

Compilation message

soccer.cpp: In function 'bool isOK(int, std::vector<std::vector<int> >)':
soccer.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |  for (int i = 0; i < okraje.size(); i++) {
      |                  ~~^~~~~~~~~~~~~~~
soccer.cpp:57:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   for (int j = 0; j < okraje.size(); j++) {
      |                   ~~^~~~~~~~~~~~~~~
soccer.cpp:28:13: warning: control reaches end of non-void function [-Wreturn-type]
   28 |  vp okraje(n);
      |             ^
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 348 KB partial
2 Runtime error 2 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 348 KB partial
2 Runtime error 2 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 348 KB partial
2 Runtime error 2 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 348 KB partial
2 Runtime error 2 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -