Submission #1000601
Source Code Expand
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
#ifdef DEBUG
#define debug(args...) {dbg,args; cerr<<endl;}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
struct debugger
{
template<typename T> debugger& operator , (const T& v)
{
cerr<<v<<" ";
return *this;
}
} dbg;
const ll mn=1e5+2;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
ll n; scanf("%lld",&n);
vector<pll> v;
for (ll i=0;i<n;i++) {
ll a;scanf("%lld",&a);
v.PB(MP(a,0));
}
for (ll i=0;i<n;i++) {
ll b;scanf("%lld",&b);
v.PB(MP(b,1));
}
sort(v.begin(),v.end());
ll ans=1;
ll cnt[2];
cnt[0]=0,cnt[1]=0;
for (auto &w:v) {
ll t=w.second;
if (cnt[t^1]) {
ans=(ans*cnt[t^1])%MOD;
cnt[t^1]--;
}
else cnt[t]++;
}
printf("%lld\n",ans);
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
LiChenKoh |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1306 Byte |
Status |
AC |
Exec Time |
50 ms |
Memory |
4464 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:34:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll n; scanf("%lld",&n);
^
./Main.cpp:37:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll a;scanf("%lld",&a);
^
./Main.cpp:41:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll b;scanf("%lld",&b);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
500 / 500 |
Status |
|
|
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 |
30 ms |
2420 KB |
001.txt |
AC |
13 ms |
1400 KB |
002.txt |
AC |
16 ms |
1400 KB |
003.txt |
AC |
19 ms |
2420 KB |
004.txt |
AC |
45 ms |
4464 KB |
005.txt |
AC |
49 ms |
4464 KB |
006.txt |
AC |
49 ms |
4464 KB |
007.txt |
AC |
49 ms |
4464 KB |
008.txt |
AC |
49 ms |
4464 KB |
009.txt |
AC |
50 ms |
4464 KB |
010.txt |
AC |
48 ms |
4464 KB |
011.txt |
AC |
48 ms |
4464 KB |
example0.txt |
AC |
3 ms |
256 KB |
example1.txt |
AC |
3 ms |
256 KB |