Submission #86996

# Submission time Handle Problem Language Result Execution time Memory
86996 2018-11-29T05:43:40 Z rakuten Star triangles (IZhO11_triangle) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define int long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 3e5+10;
const int inf = 1e9+7;
int n , l ,r;
pair < int,int > a[N];
int ans = 0;
map x [N] , y [N] ;

 main(){

	cin >> n;
	for(int i = 1 ; i <= n ; i++ )
    {
		cin >> a[i].fr >> a[i].sc;
		x[a[i].fr] ++ ;
		y[a[i].sc] ++ ;
	}

	for(int i = 1 ; i <= n ; i++ )
    {
		l = x[a[i].fr] -1 ;
		r = y[a[i].sc] -1 ;
		ans += l*r ;
	}

	cout << ans << endl;
}

Compilation message

triangle.cpp:19:1: error: invalid use of template-name 'std::map' without an argument list
 map x [N] , y [N] ;
 ^~~
triangle.cpp:19:1: note: class template argument deduction is only available with -std=c++1z or -std=gnu++1z
In file included from /usr/include/c++/7/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:81,
                 from triangle.cpp:1:
/usr/include/c++/7/bits/stl_map.h:99:11: note: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' declared here
     class map
           ^~~
triangle.cpp:21:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main(){
       ^
triangle.cpp: In function 'int main()':
triangle.cpp:27:3: error: 'x' was not declared in this scope
   x[a[i].fr] ++ ;
   ^
triangle.cpp:28:3: error: 'y' was not declared in this scope
   y[a[i].sc] ++ ;
   ^
triangle.cpp:33:7: error: 'x' was not declared in this scope
   l = x[a[i].fr] -1 ;
       ^
triangle.cpp:34:7: error: 'y' was not declared in this scope
   r = y[a[i].sc] -1 ;
       ^