Submission #1000586


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  scanf("%d",&n);
  static int a[100000],b[100000];
  for(int i=0;i<n;i++){
    scanf("%d",a+i);
  }
  for(int j=0;j<n;j++){
    scanf("%d",b+j);
  }
  sort(a,a+n);
  sort(b,b+n);
  long long ans=1ll;
  const long long mod=1000000007ll;
  int K=0;
  for(int i=0,j=0;i<n&&j<n;){
    if(j==n||a[i]<b[j]){
      if(K<0){
	ans*=-K;
	ans%=mod;
      }
      K++;
      i++;
    }
    else{
      if(K>0){
	ans*=K;
	ans%=mod;
      }
      K--;
      j++;
    }
  }
  printf("%lld\n",K);
  return 0;
}

Submission Info

Submission Time
Task A - 1D Matching
User Huziwara
Language C++14 (GCC 5.4.1)
Score 0
Code Size 605 Byte
Status WA
Exec Time 40 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]
   printf("%lld\n",K);
                    ^
./Main.cpp:7:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
./Main.cpp:10:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",a+i);
                    ^
./Main.cpp:13:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",b+j);
                    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 3
WA × 11
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 25 ms 768 KB
001.txt WA 10 ms 384 KB
002.txt WA 13 ms 640 KB
003.txt WA 15 ms 512 KB
004.txt WA 36 ms 896 KB
005.txt WA 40 ms 1024 KB
006.txt WA 40 ms 1024 KB
007.txt WA 40 ms 1024 KB
008.txt WA 40 ms 1024 KB
009.txt WA 39 ms 1024 KB
010.txt WA 39 ms 1024 KB
011.txt AC 40 ms 1024 KB
example0.txt AC 3 ms 256 KB
example1.txt AC 3 ms 256 KB