Submission #1811347
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 | 948 Byte |
Status | WA |
Exec Time | 880 ms |
Memory | 95712 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 | 614 ms | 65148 KB |
001.txt | WA | 403 ms | 46432 KB |
002.txt | WA | 471 ms | 46244 KB |
003.txt | WA | 488 ms | 51968 KB |
004.txt | WA | 761 ms | 74124 KB |
005.txt | WA | 876 ms | 95712 KB |
006.txt | WA | 877 ms | 95452 KB |
007.txt | WA | 850 ms | 88812 KB |
008.txt | WA | 880 ms | 95528 KB |
009.txt | WA | 880 ms | 94140 KB |
010.txt | WA | 846 ms | 94260 KB |
011.txt | AC | 867 ms | 94032 KB |
example0.txt | AC | 96 ms | 21332 KB |
example1.txt | AC | 94 ms | 21972 KB |