提出 #1477229
ソースコード 拡げる
#include <stdio.h>
#define MOD (int)(1e9+7)
long combi(int, int);
int a[100001];
int main(void)
{
int n, i, tmp, left, right;
long res;
scanf("%d", &n);
for(i = 0; i < n; i++) a[i] = -1;
for(i = 0; i < n; i++){
scanf("%d", &tmp);
if(a[tmp] == -1)
a[tmp] = i+1;
else{
left = a[tmp];
right = i+1;
}
}
for(i = 1; i <= n+1; i++){
res = combi(n+1, i)%MOD - combi((left-1)+(n+1-right), i-1)%MOD;
printf("%ld\n", res%MOD);
}
return 0;
}
long combi(int n, int r)
{
int i;
long p = 1;
for(i = 1; i <= r; i++)
p = p%MOD * (n - i + 1)/i;
return p;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - 11 |
| ユーザ | Lionking07 |
| 言語 | C (GCC 5.4.1) |
| 得点 | 0 |
| コード長 | 653 Byte |
| 結果 | WA |
| 実行時間 | 2103 ms |
| メモリ | 640 KiB |
コンパイルエラー
./Main.c: In function ‘main’:
./Main.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.c:14:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &tmp);
^
ジャッジ結果
| セット名 | Sample | All | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 600 | ||||||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt |
| All | 1.txt, mx.txt, rnd_0.txt, rnd_1.txt, rnd_2.txt, rnd_3.txt, rnd_4.txt, sample1.txt, sample2.txt, sample3.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 1.txt | TLE | 2103 ms | 640 KiB |
| mx.txt | TLE | 2103 ms | 640 KiB |
| rnd_0.txt | TLE | 2103 ms | 512 KiB |
| rnd_1.txt | TLE | 2103 ms | 512 KiB |
| rnd_2.txt | TLE | 2103 ms | 384 KiB |
| rnd_3.txt | TLE | 2103 ms | 256 KiB |
| rnd_4.txt | TLE | 2103 ms | 384 KiB |
| sample1.txt | AC | 1 ms | 128 KiB |
| sample2.txt | AC | 1 ms | 128 KiB |
| sample3.txt | WA | 1 ms | 128 KiB |