結果
問題 |
No.1680 Sum and Difference
|
ユーザー |
![]() |
提出日時 | 2021-09-18 10:40:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 3,618 ms |
コンパイル使用メモリ | 229,960 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 07:56:28 |
合計ジャッジ時間 | 4,451 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll=long long; using Graph=vector<vector<int>>; #define MAX 2000005 #define MOD 1000000007 //#define MOD 998244353 #define INF 1000000000 //#define INF 1000000000000000000 int main(){ ll A,B; cin>>A>>B; if(B>=A){ //ans=(A+1)*(A+2)/2-4*A-3 A%=MOD; ll ans=4*(A+1)*(A+2)/2%MOD+4*(MOD-A)+MOD-3; ans%=MOD; cout<<ans<<'\n'; }else{ ll ans=0; if(A%2!=B%2){ ans+=2*B; A--; } ll a=(2*B+1)%MOD; ans+=a*(A%MOD)%MOD+(B+1)%MOD; ans%=MOD; cout<<ans<<'\n'; return 0; } }