Submission #1000803


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;
		int ans = 1;
		for(int i=1;i<=2*N;i++)
		{
			if(!arr[i].flag)
			{
				cnt++;
			}
			else 
			{
				if(cnt != 0)
				{
					int 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 819 Byte
Status WA
Exec Time 47 ms
Memory 1664 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:55:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]
   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);
                         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 2
WA × 14
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt WA 28 ms 1152 KB
001.txt WA 11 ms 512 KB
002.txt WA 15 ms 640 KB
003.txt WA 16 ms 640 KB
004.txt WA 41 ms 1536 KB
005.txt WA 46 ms 1664 KB
006.txt WA 47 ms 1664 KB
007.txt WA 46 ms 1664 KB
008.txt WA 46 ms 1664 KB
009.txt WA 46 ms 1664 KB
010.txt WA 46 ms 1664 KB
011.txt WA 46 ms 1664 KB
example0.txt WA 1 ms 128 KB
example1.txt WA 1 ms 128 KB