CSES - COCI 2006/2007 #3 - Results
Submission details
Task:Trojke
Sender:henrikaalto
Submission time:2019-07-24 14:23:27 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#20.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails
#70.01 sdetails
#80.01 sdetails
#90.01 sdetails
#100.01 sdetails

Code

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<string> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
	}
	vector<vector<int>> s;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (v[i][j] == '.') continue;
			for (int it = 0; it < n; ++it) {
				for (int jt = 0; jt < n; ++jt) {
					if (v[it][jt] == '.') continue;
					if (it == i && jt == j) continue;
					int ix = it - i;
					int jx = jt - j;
					if (it + ix >= n || jt + jx >= n) continue;
					if (it + ix < 0 || jt + jx < 0) continue;
					if (v[it + ix][jt + jx] == '.') continue;
					vector<int> lol = {v[i][j], v[it][jt], v[it + ix][jt + jx]};
					sort(lol.begin(), lol.end());
					s.push_back(lol);
				}
			}
		}
	}
	cout << (unique(s.begin(), s.end()) - s.begin()) << "\n";
}

Test details

Test 1

Verdict: ACCEPTED

input
3
AB.
.CD
..E

correct output
1

user output
1

Test 2

Verdict:

input
5
A.G.H
.....
B.C.I
.....
...

correct output
8

user output
15

Test 3

Verdict:

input
8
..HK....
.....C..
.......J
E...B...
...

correct output
10

user output
6

Test 4

Verdict:

input
10
..........
....WZ....
......I...
...A......
...

correct output
7

user output
1

Test 5

Verdict:

input
30
.................................

correct output
14

user output
2

Test 6

Verdict:

input
50
.................................

correct output
6

user output
2

Test 7

Verdict:

input
80
.................................

correct output
97

user output
10

Test 8

Verdict:

input
90
.................................

correct output
81

user output
1

Test 9

Verdict:

input
99
.................................

correct output
148

user output
10

Test 10

Verdict:

input
100
.................................

correct output
132

user output
8