Submission #167474

# Submission time Handle Problem Language Result Execution time Memory
167474 2019-12-08T16:15:45 Z Toirov_Sadi Star triangles (IZhO11_triangle) C++17
0 / 100
4 ms 376 KB
#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 3e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

long long n;
long long res;
pair<long long, long long> d[N];
int main()
{
    freopen( "triangles.in", "r", stdin );
    freopen( "triangles.out", "w", stdout );

    ios_base::sync_with_stdio( false );

    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> d[i].fr >> d[i].se;
    }
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= n; j ++){
            for(int k = 1; k <= n; k ++){
                if(i == j || i == k || j == k){
                    continue;
                }
                pair<long long, long long> a = d[i];
                pair<long long, long long> b = d[j];
                pair<long long, long long> c = d[k];
                res += (a.fr == b.fr && b.se == c.se);
            }
        }
    }cout << res << "\n";
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen( "triangles.in", "r", stdin );
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen( "triangles.out", "w", stdout );
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -