Submission #2592030
Source Code Expand
#include <iostream> using namespace std; #include <list> #include <stack> #include <algorithm> #define ll long long //00p0d0dp0p0d int main(){ int n; cin >>n; int a[n]; int b[n]; list<int> vacant; int ans=0; ll codelen=9223372036854775807; for(int i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n); for(int i=0;i<n;i++){ cin >> b[i]; // vacant.push_back(b[i]); } sort(b,b+n); int curlen=0; for(int i=0;i<n;i++){ curlen+=abs(a[i]-b[i]); } ans=1; int another[n]; for(int i=0;i<n-1; i++){ int x=abs(a[i]-b[i])+abs(a[i+1]-b[i+1]); int y=abs(a[i]-b[i+1])+abs(a[i+1]-b[i]); if (x==y){ ans*=2; } } cout <<ans<<endl; // cout <<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | Ry0um4 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 840 Byte |
Status | WA |
Exec Time | 92 ms |
Memory | 1024 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 | 56 ms | 768 KB |
001.txt | WA | 21 ms | 384 KB |
002.txt | WA | 32 ms | 512 KB |
003.txt | WA | 32 ms | 512 KB |
004.txt | WA | 82 ms | 896 KB |
005.txt | WA | 92 ms | 1024 KB |
006.txt | WA | 91 ms | 1024 KB |
007.txt | WA | 91 ms | 1024 KB |
008.txt | WA | 91 ms | 1024 KB |
009.txt | WA | 92 ms | 1024 KB |
010.txt | WA | 92 ms | 1024 KB |
011.txt | AC | 92 ms | 1024 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |