CODE FESTIVAL 2016 Grand Final(Parallel)

Submission #1291436

Source codeソースコード

#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

i32 n;
vec<i64> a, b;
i64 c[100001];

i32 main()
{
	cin >> n;
	a.resize(n); b.resize(n);
	times(n, i) { cin >> a[i]; }
	times(n, i) { cin >> b[i]; }
	sortall(a);
	sortall(b);
	i64 ans = 1;
	times(n, i) {
		if (a[i] < b[i]) {
			i32 cnt = 0;
			i64 j = i;
			while (j < a.size() && a[j] < b[i]) {
				cnt++;
				j++;
			}
			ans *= cnt;
		} else {
			i32 cnt = 0;
			i64 j = i;
			while (j < b.size() && b[j] < a[i]) {
				cnt++;
				j++;
			}
			ans *= cnt;
		}
	}
	i64 minl = 0;
	times(n, i) {
		minl += abs(a[i] - b[i]);
	}
	cout << ans << endl;
    return 0;
}

Submission

Task問題 A - 1D Matching
User nameユーザ名 Tatsuno
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1493 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - example0.txt,example1.txt
All 0 / 500 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
000.txt WA
001.txt WA
002.txt WA
003.txt WA
004.txt WA
005.txt WA
006.txt WA
007.txt WA
008.txt WA
009.txt WA
010.txt TLE
011.txt AC 93 ms 1792 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB