結果
| 問題 |
No.1520 Zigzag Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-28 21:34:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 212 ms / 2,000 ms |
| コード長 | 435 bytes |
| コンパイル時間 | 547 ms |
| コンパイル使用メモリ | 67,288 KB |
| 実行使用メモリ | 7,624 KB |
| 最終ジャッジ日時 | 2024-11-07 09:04:43 |
| 合計ジャッジ時間 | 2,643 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint1000000007;
mint fac[4<<17],inv[4<<17];
main()
{
fac[0]=1;
for(int i=1;i<4<<17;i++)fac[i]=fac[i-1]*i;
inv[(4<<17)-1]=1/fac[(4<<17)-1];
for(int i=(4<<17)-1;i--;)inv[i]=inv[i+1]*(i+1);
int T;cin>>T;
for(;T--;)
{
int H,W;cin>>H>>W;
if(H==1||W==1)cout<<0<<endl;
else
{
cout<<(2*fac[H+W-3]*inv[H-2]*inv[W-2]).val()<<endl;
}
}
}