Submission #1000801


Source Code Expand

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

int N;
struct node
{
	int x;
	bool flag;
}arr[200001];
bool cmp(node a,node b)
{
	return a.x > b.x;
}
int main()
{
	while(~scanf("%d",&N))
	{
		for(int i=1;i<=N;i++)
		{
			scanf("%d",&arr[i].x);
			arr[i].flag = 0;
		}
		for(int i=N+1;i<=2*N;i++)
		{
			scanf("%d",&arr[i].x);
			arr[i].flag = 1;
		}
		sort(arr+1,arr+1+2*N,cmp);
		int cnt = 0;
		__int64 ans = 1;
		for(int i=1;i<=2*N;i++)
		{
			if(!arr[i].flag)
			{
				cnt++;
			}
			else 
			{
				if(cnt != 0)
				{
					__int64 tmp = 1;
					for(int k=1;k<=cnt;k++)
					{
						tmp *= k;
						tmp %= 1000000000 + 7;
					}
					ans *= tmp;
					ans %= 1000000000 + 7;
				}
				cnt = 0;
			}
		}
		printf("%lld",ans);
	}
	return 0;
}

Submission Info

Submission Time
Task A - 1D Matching
User coderLFR
Language C++14 (GCC 5.4.1)
Score 0
Code Size 827 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:3: error: ‘__int64’ was not declared in this scope
   __int64 ans = 1;
   ^
./Main.cpp:43:14: error: expected ‘;’ before ‘tmp’
      __int64 tmp = 1;
              ^
./Main.cpp:46:7: error: ‘tmp’ was not declared in this scope
       tmp *= k;
       ^
./Main.cpp:49:6: error: ‘ans’ was not declared in this scope
      ans *= tmp;
      ^
./Main.cpp:49:13: error: ‘tmp’ was not declared in this scope
      ans *= tmp;
             ^
./Main.cpp:55:17: error: ‘ans’ was not declared in this scope
   printf("%lld",ans);
                 ^
./Main.cpp:22:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&arr[i].x);
                         ^
./Main.cpp:27:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&arr[i].x);
                         ^