CODE FESTIVAL 2016 Grand Final(Parallel)

Submission #1338448

Source codeソースコード

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int a[100000], b[100000];
ll fact[100001];
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d", &a[i]);
	rep(i, n)scanf("%d", &b[i]);
	sort(a, a + n); sort(b, b + n);
	fact[0] = 1;
	for (int i = 1; i <= n; i++)fact[i] = (fact[i - 1] * i) % MOD;
	int s = 0;
	ll ans = 1;
	while (s < n) {
		if (a[s] < b[s]) {
			int i; for (i = s; i < n&&a[i] < b[s]; i++);
			(ans *= fact[i - s]) %= MOD; s = i;
		}
		else {
			int i; for (i = s; i < n&&b[i] < a[s]; i++);
			(ans *= fact[i - s]) %= MOD; s = i;
		}
	}
	printf("%lld\n", ans);
}

Submission

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

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int n; scanf("%d", &n);
^
./Main.cpp:11:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, n)scanf("%d", &a[i]);
^
./Main.cpp:12:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, n)scanf("%d", &b[i]);
^

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 AC 37 ms 1792 KB
011.txt AC 38 ms 1792 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB