Submission #1811317
Source Code Expand
import java.util.Arrays; import java.util.Scanner; class event implements Comparable<event>{ public int a; public int b; public event(int a , int b){ this.a = a; this.b = b; } public int compareTo(event other){ // return b - other.b; return Integer.compare(b , other.b); } } public class Main{ public static void main(String[] args) { long mod = 10^9+7; Scanner in = new Scanner(System.in); int n = in.nextInt(); int size[] = new int[2]; event[] a = new event[2*n]; for (int x=0; x<2; x++) for (int i=0; i< n; i++) a[i+x*n] = new event(x, in.nextInt()); Arrays.sort(a); long res = 1; for(event e : a){ if(size[1 - e.a] > 0){ res *= size[1 - e.a]; res %= mod; size[1 - e.a]--; }else{ size[e.a]++; } } System.out.println(res); } }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | Younes |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 940 Byte |
Status | WA |
Exec Time | 891 ms |
Memory | 96652 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 605 ms | 64880 KB |
001.txt | WA | 396 ms | 46316 KB |
002.txt | WA | 471 ms | 50572 KB |
003.txt | WA | 467 ms | 51848 KB |
004.txt | WA | 759 ms | 77444 KB |
005.txt | WA | 891 ms | 96364 KB |
006.txt | WA | 879 ms | 96152 KB |
007.txt | WA | 850 ms | 96384 KB |
008.txt | WA | 785 ms | 96652 KB |
009.txt | WA | 822 ms | 90800 KB |
010.txt | WA | 820 ms | 94608 KB |
011.txt | AC | 808 ms | 95708 KB |
example0.txt | AC | 93 ms | 21716 KB |
example1.txt | AC | 93 ms | 20948 KB |