Submission #18981555


Source Code Expand

Copy
//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
int n;
vector<P>vec;
ll ans = 1;
int cur;

int main(){
	cin >> n;
	rep(i, n){
		int a; cin >> a; vec.pb(mp(a, 1));
	}
	rep(i, n){
		int a; cin >> a; vec.pb(mp(a, -1));
	}
	SORT(vec);
	rep(i, vec.size()){
		if(cur > 0 && vec[i].sc < 0) ans = ans * cur % mod;
		if(cur < 0 && vec[i].sc > 0) ans = ans * -cur % mod;
		cur += vec[i].sc;
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task A - 1D Matching
User IH19980412
Language C++ (GCC 9.2.1)
Score 500
Code Size 1771 Byte
Status AC
Exec Time 79 ms
Memory 5284 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:19:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   19 | #define rep(i,x) for(int i=0;i<x;i++)
......
   76 |  rep(i, vec.size()){
      |      ~~~~~~~~~~~~~             
./Main.cpp:76:2: note: in expansion of macro ‘rep’
   76 |  rep(i, vec.size()){
      |  ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 14
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 55 ms 4200 KB
001.txt AC 21 ms 3724 KB
002.txt AC 31 ms 3708 KB
003.txt AC 34 ms 4104 KB
004.txt AC 73 ms 5160 KB
005.txt AC 76 ms 5232 KB
006.txt AC 76 ms 5204 KB
007.txt AC 78 ms 5284 KB
008.txt AC 75 ms 5268 KB
009.txt AC 79 ms 5152 KB
010.txt AC 76 ms 5152 KB
011.txt AC 76 ms 5272 KB
example0.txt AC 2 ms 3372 KB
example1.txt AC 2 ms 3580 KB