提出 #50622337
ソースコード 拡げる
#include <bits/stdc++.h>
#include <atcoder/modint>
const int MOD=998244353;
using mint = atcoder::static_modint<MOD>;
using namespace std;
typedef long long ll;
#define rep(i,a,n) for (ll i=a;i<(ll)(n);i++)
ll read(){ll r;scanf("%lld",&r);return r;}
mint I[200010];
int main(){
I[1]=1;
rep(i,2,200000+1) I[i]=(MOD-MOD/i)*I[MOD%i];
int n=read();
int m=read();
int a=read();
int b=read();
int c=read();
int d=read();
if(a>c) swap(a,c);
if(b>d) swap(b,d);
int e=c-a+d-b;
mint ans=1;
for(int u:{a-1,n-c,b-1,m-d})rep(i,1,u+1)ans+=I[i+e];
printf("%d\n",ans.val());
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Paper Cutting 2 |
| ユーザ | cromarmot |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 700 |
| コード長 | 589 Byte |
| 結果 | AC |
| 実行時間 | 3 ms |
| メモリ | 4656 KiB |
コンパイルエラー
Main.cpp: In function ‘ll read()’:
Main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | ll read(){ll r;scanf("%lld",&r);return r;}
| ~~~~~^~~~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 700 / 700 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt, s4.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, s1.txt, s2.txt, s3.txt, s4.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 3 ms | 4436 KiB |
| 02.txt | AC | 3 ms | 4376 KiB |
| 03.txt | AC | 3 ms | 4544 KiB |
| 04.txt | AC | 3 ms | 4608 KiB |
| 05.txt | AC | 3 ms | 4544 KiB |
| 06.txt | AC | 2 ms | 4520 KiB |
| 07.txt | AC | 2 ms | 4348 KiB |
| 08.txt | AC | 3 ms | 4548 KiB |
| 09.txt | AC | 3 ms | 4472 KiB |
| 10.txt | AC | 3 ms | 4524 KiB |
| 11.txt | AC | 3 ms | 4352 KiB |
| 12.txt | AC | 3 ms | 4444 KiB |
| 13.txt | AC | 3 ms | 4396 KiB |
| 14.txt | AC | 3 ms | 4524 KiB |
| 15.txt | AC | 3 ms | 4344 KiB |
| 16.txt | AC | 3 ms | 4656 KiB |
| 17.txt | AC | 2 ms | 4520 KiB |
| s1.txt | AC | 2 ms | 4572 KiB |
| s2.txt | AC | 3 ms | 4348 KiB |
| s3.txt | AC | 3 ms | 4608 KiB |
| s4.txt | AC | 2 ms | 4528 KiB |