Submission #1988469
Source Code Expand
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>
#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007LL
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};
ll productmod(ll x, ll y){
if(x*y >= MOD) return (x*y) % MOD;
else return x*y;
}
ll powmod(ll a, ll t){
ll ret = 1LL;
while(t){
if(t & 1LL){
ret = productmod(ret, a);
}
a = productmod(a, a);
t >>= 1LL;
}
return ret;
}
int main(){
std::ios::sync_with_stdio(0); cin.tie(0);
int n;
scanf("%d", &n);
vector<int> a(n), b(n);
rep(n) scanf("%d", &a[i]);
rep(n) scanf("%d", &b[i]);
sort(all(a));
sort(all(b));
ll ans = 1LL, cnt = 0LL;
rep(n-1){
if(abs(a[i]-b[i]) == abs(a[i+1]-b[i+1])) cnt++;
}
(ans *= powmod(2LL, cnt)) %= MOD;
printf("%lld\n", ans);
}
Submission Info
Submission Time |
|
Task |
A - 1D Matching |
User |
Noimin |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1345 Byte |
Status |
WA |
Exec Time |
36 ms |
Memory |
1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:51:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:53:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(n) scanf("%d", &a[i]);
^
./Main.cpp:54:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(n) 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 |
22 ms |
768 KB |
001.txt |
WA |
8 ms |
384 KB |
002.txt |
WA |
12 ms |
512 KB |
003.txt |
WA |
13 ms |
512 KB |
004.txt |
WA |
32 ms |
1024 KB |
005.txt |
WA |
36 ms |
1024 KB |
006.txt |
WA |
36 ms |
1024 KB |
007.txt |
WA |
36 ms |
1024 KB |
008.txt |
WA |
36 ms |
1024 KB |
009.txt |
WA |
36 ms |
1024 KB |
010.txt |
WA |
36 ms |
1024 KB |
011.txt |
WA |
36 ms |
1024 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |