Submission #1000583
Source Code Expand
#include<stdio.h> #include<vector> #include<algorithm> using namespace std; typedef long long ll; ll mod=1000000007; typedef pair<int,int>pii; int main() { int num; scanf("%d",&num); vector<pii>v; for(int i=0;i<num;i++) { int z; scanf("%d",&z); v.push_back(make_pair(z,-1)); } for(int i=0;i<num;i++) { int z; scanf("%d",&z); v.push_back(make_pair(z,1)); } sort(v.begin(),v.end()); vector<int>now; ll ans=1; int cnt=0; for(int i=0;i<num*2;i++) { cnt+=v[i].second; now.push_back(v[i].second); if(cnt==0) { int p=now[0]; ll c=0; for(int j=0;j<now.size();j++) { if(p==now[j])c++; else { ans*=c; ans%=mod; c--; } } now.clear(); } } printf("%lld\n",ans); }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | DEGwer |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 788 Byte |
Status | AC |
Exec Time | 49 ms |
Memory | 3568 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:11:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&num); ^ ./Main.cpp:16:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&z); ^ ./Main.cpp:22:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&z); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 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 | AC | 30 ms | 2036 KB |
001.txt | AC | 12 ms | 1016 KB |
002.txt | AC | 16 ms | 892 KB |
003.txt | AC | 18 ms | 1400 KB |
004.txt | AC | 43 ms | 2544 KB |
005.txt | AC | 48 ms | 2420 KB |
006.txt | AC | 49 ms | 2544 KB |
007.txt | AC | 47 ms | 2420 KB |
008.txt | AC | 48 ms | 2800 KB |
009.txt | AC | 48 ms | 2420 KB |
010.txt | AC | 49 ms | 3568 KB |
011.txt | AC | 47 ms | 2420 KB |
example0.txt | AC | 2 ms | 256 KB |
example1.txt | AC | 2 ms | 256 KB |