Submission #1135566


Source Code Expand

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#define P pair<int,int>
#define mod 1000000007
using namespace std;

P a[200000];
int hanten[2] = { 1,0 };
signed main() {
	int b; cin >> b;
	for (int c = 0; c < b; c++) {
		int d; scanf("%d", &d);
		a[c] = P(d, 0);
	}
	for (int c = 0; c < b; c++) {
		int d; scanf("%d", &d);
		a[b + c] = P(d, 1);
	}
	sort(a, a + b * 2);
	long long ans = 1;
	int count[2]{};
	for (int i = 0; i < b * 2; i++) {
		int s = a[i].second;
		if (count[hanten[s]] == 0) {
			count[s]++;
		}
		else {
			ans = ans*count[hanten[s]] % mod;
			count[hanten[s]]--;
		}
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task A - 1D Matching
User naoki2016
Language C++14 (GCC 5.4.1)
Score 500
Code Size 778 Byte
Status AC
Exec Time 40 ms
Memory 1792 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:20:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   int d; scanf("%d", &d);
                         ^
./Main.cpp:24:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   int d; scanf("%d", &d);
                         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 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 AC 24 ms 1152 KB
001.txt AC 9 ms 640 KB
002.txt AC 13 ms 768 KB
003.txt AC 14 ms 768 KB
004.txt AC 36 ms 1664 KB
005.txt AC 40 ms 1792 KB
006.txt AC 40 ms 1792 KB
007.txt AC 40 ms 1792 KB
008.txt AC 40 ms 1792 KB
009.txt AC 40 ms 1792 KB
010.txt AC 40 ms 1792 KB
011.txt AC 39 ms 1792 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB