Submission #1000624


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

vector<pii> a;
int fac[N];

int main(){
  int n; 
  scanf("%d",&n);
  
  REP(i,n){
    int x; scanf("%d",&x);
    a.pb(mp(x,1));
  }
  REP(i,n){
    int x; scanf("%d",&x);
    a.pb(mp(x,-1));
  }
  int crr=0;
  sort(all(a));
  ll ans=1;
  REP(i,a.size()){
    int lst = abs(crr);
    crr+=a[i].Y;
    int nw = abs(crr);
//    printf("%d %d %d\n",crr,lst,nw);
    if(nw<lst) ans=ans*lst%mod;
  }

  printf("%lld\n",ans);
  return 0;

}

Submission Info

Submission Time
Task A - 1D Matching
User alecsyde
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1349 Byte
Status AC
Exec Time 46 ms
Memory 2420 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:42:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
./Main.cpp:45:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int x; scanf("%d",&x);
                          ^
./Main.cpp:49:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int x; scanf("%d",&x);
                          ^

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 28 ms 1400 KB
001.txt AC 12 ms 892 KB
002.txt AC 15 ms 892 KB
003.txt AC 17 ms 1400 KB
004.txt AC 42 ms 2420 KB
005.txt AC 46 ms 2420 KB
006.txt AC 46 ms 2420 KB
007.txt AC 46 ms 2420 KB
008.txt AC 46 ms 2420 KB
009.txt AC 46 ms 2420 KB
010.txt AC 44 ms 2420 KB
011.txt AC 44 ms 2420 KB
example0.txt AC 2 ms 256 KB
example1.txt AC 2 ms 256 KB