Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const int maxn = 200000 + 100;
- struct Vector {
- int x, y;
- Vector() : x(0), y(0) {}
- Vector(int x, int y) : x(x), y(y) {}
- };
- Vector operator+(const Vector &a, const Vector &b) {
- return Vector(a.x + b.x, a.y + b.y);
- }
- int operator*(const Vector &a, const Vector &b) {
- return a.x * b.x + a.y * b.y;
- }
- Vector rotate90(const Vector &v) {
- return Vector(Vector(0, -1) * v, Vector(1, 0) * v);
- }
- int n = 10;
- set<int> st;
- string G[10] = {
- "1101011111",
- "1110011110",
- "1100101111",
- "1011011110",
- "1010111100",
- "1001010101",
- "1111111110",
- "0111111110",
- "0110101111",
- "1010010100"
- };
- bool judge(const Vector &p) {
- return p.x >= 0 && p.x < n && p.y >= 0 && p.y < n && G[p.x][p.y] == '1';
- }
- bool judge(int x1, int y1, int x2, int y2) {
- Vector v(x2 - x1, y2 - y1);
- v = rotate90(v);
- Vector p = Vector(x2, y2) + v;
- if (!judge(p)) {
- return false;
- }
- v = rotate90(v);
- p = p + v;
- return judge(p);
- }
- int main() {
- #ifdef ExRoc
- freopen("test.txt", "r", stdin);
- #endif // ExRoc
- ios::sync_with_stdio(false);
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- if (G[i][j] != '1') {
- continue;
- }
- for (int k = 0; k < n; ++k) {
- for (int l = 0; l < n; ++l) {
- if (G[k][l] != '1') {
- continue;
- }
- if (judge(i, j, k, l)) {
- Vector v(k - i, l - j);
- st.insert(v * v);
- }
- }
- }
- }
- }
- st.erase(0);
- cout << st.size() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement