CSES - COCI 2006/2007 #3 - Results
Submission details
Task:Trojke
Sender:untokarila
Submission time:2019-07-24 15:01:41 +0300
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.01 sdetails

Code

#include <iostream>
#include <complex>
#include <vector>
#define X real()
#define Y imag()

using namespace std;

vector<complex<int> > v;

int main(){
    int n;
    cin >> n;

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            char c;
            cin >> c;
            if(c != '.') v.push_back({i, j});
        }
    }

    int z = v.size();
    int t = 0;

    for(int i=0; i<z; i++){
        for(int j=i+1; j<z; j++){
            for(int k=j+1; k<z; k++){
                if((conj(v[i]-v[j])*(v[i]-v[k])).Y == 0) t++;
            }
        }
    }

    cout << t;
}

Test details

Test 1

Verdict: ACCEPTED

input
3
AB.
.CD
..E

correct output
1

user output
1

Test 2

Verdict: ACCEPTED

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

correct output
8

user output
8

Test 3

Verdict: ACCEPTED

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

correct output
10

user output
10

Test 4

Verdict: ACCEPTED

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

correct output
7

user output
7

Test 5

Verdict: ACCEPTED

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

correct output
14

user output
14

Test 6

Verdict: ACCEPTED

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

correct output
6

user output
6

Test 7

Verdict: ACCEPTED

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

correct output
97

user output
97

Test 8

Verdict: ACCEPTED

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

correct output
81

user output
81

Test 9

Verdict: ACCEPTED

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

correct output
148

user output
148

Test 10

Verdict: ACCEPTED

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

correct output
132

user output
132