Submission #1712921
Source Code Expand
#include<bits/stdc++.h> using namespace std; const int mod = 1000*1000*1000+7; int N; vector<int> A, B; int main() { scanf("%d", &N); A.resize(N); B.resize(N); for(int i = 0; i < N; i++) { scanf("%d", &A[i]); } for(int i = 0; i < N; i++) { scanf("%d", &B[i]); } sort(A.begin(), A.end()); sort(B.begin(), B.end()); int ans = 1; for(int i = N - 1; i >= 0; i--) { int s = i + 1, e = N - 1; int p = i; while(s <= e) { int m = (s + e)>>1; if(A[m] <= B[i]) { p = m; s = m + 1; } else e = m - 1; } ans = 1LL * ans * (p - i + 1) % mod; } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | choikiwon |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 790 Byte |
Status | WA |
Exec Time | 39 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:10:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.cpp:16:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &A[i]); ^ ./Main.cpp:19:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &B[i]); ^
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 | 23 ms | 768 KB |
001.txt | WA | 9 ms | 384 KB |
002.txt | WA | 12 ms | 512 KB |
003.txt | WA | 14 ms | 512 KB |
004.txt | WA | 34 ms | 896 KB |
005.txt | WA | 39 ms | 1024 KB |
006.txt | WA | 39 ms | 1024 KB |
007.txt | WA | 39 ms | 1024 KB |
008.txt | WA | 38 ms | 1024 KB |
009.txt | WA | 39 ms | 1024 KB |
010.txt | WA | 38 ms | 1024 KB |
011.txt | AC | 38 ms | 1024 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |