# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003428 | thelepi | Dijamant (COCI22_dijamant) | C++17 | 180 ms | 8028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <cassert>
#include <vector>
using namespace std;
bool inBounds(int x, int y, int n, int m){
return x >= 0 && x < m && y >= 0 && y < n;
}
//End inclusive
bool isDiamond(vector<vector<char>> &table, int n, int m, int ax, int ay, int bx, int by){
int sidelength = bx - ax + 1;
//last row of #
if(!inBounds(ax + sidelength - 1, ay + sidelength - 1, n, m) ||
!inBounds(bx + sidelength - 1, by + sidelength - 1, n, m))
return false;
for (int i = 0; i < sidelength; i++)
{
if(table[ay + sidelength - 1 - i][ax + sidelength - 1 + i] != '#')
return false;
}
for (int i = 1; i < sidelength - 1; i++)
{
//Side of #
if(!inBounds(ax + i, ay + i, n, m) ||
!inBounds(bx + i, by + i, n, m) ||
table[ay + i][ax + i] != '#' ||
table[by + i][bx + i] != '#')
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |