Submission #1010571

# Submission time Handle Problem Language Result Execution time Memory
1010571 2024-06-29T08:15:17 Z lrancic Crazy old lady (IZhO13_crazy) C++17
0 / 100
1 ms 348 KB
#include <iostream>
#include <vector>

int solve(int n, std::vector<int> &line) {
	if (line[0] == 1) return 1;
	if (n == 2) return line.back() == 2;
	if (line[n-2] < line[n-3]) return line[n-2];
	return 0;
}

int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
	int _; std::cin >> _; while (_--) {
		int n; std::cin >> n; std::vector<int> line(n); for (int i = 0; i < n; i++) std::cin >> line[i];
		std::cout << solve(n, line) << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -