結果
| 問題 |
No.2847 Birthday Attack
|
| コンテスト | |
| ユーザー |
yamada
|
| 提出日時 | 2024-08-23 23:00:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,093 bytes |
| コンパイル時間 | 3,380 ms |
| コンパイル使用メモリ | 160,516 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-23 23:00:27 |
| 合計ジャッジ時間 | 4,852 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | WA * 14 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <bitset>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>=b;--i)
#define fore(i, a) for(auto& i : a)
#define pi 3.141592653589793238
typedef long long ll;
typedef pair<ll,ll> pp;
typedef vector<ll> vl;
typedef vector<ulong> vu;
typedef vector<vl> vvl;
typedef vector<pp> vp;
typedef vector<vp> vvp;
typedef priority_queue<pp, vp, greater<pp> > pq;
vl kaijou;
void kaijou_set(ll m) {kaijou.push_back(1); rep(i, 1, 1000009)kaijou.push_back((kaijou[i-1] * i) % m); return;}
ll C(ll a, ll b, ll m) {if(a < b) return 0; return (kaijou[a] * pow_mod(kaijou[a-b] * kaijou[b], m-2, m)) % m;}
template <typename T, typename F>
T bisect(T ok, T bad, F pred) {while (bad - ok > 1) {T mid = ok + (bad - ok) / 2; (pred(mid) ? ok : bad) = mid;} return bad;}
bool chmin(ll &a, ll b) {if (a > b) {a = b;return true;} return false;}
bool chmax(ll &a, ll b) {if (a < b) {a = b;return true;} return false;}
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
ll gcd(ll x, ll y) {if(y == 0)return x; return gcd(y, x % y); }
ll RU(ll a, ll b) {return a / b + (a % b && (a ^ b) >= 0); }
ll mod=998244353; ll mof=1000000007;
int main()
{
ll x,y,m;
cin>>x>>y>>m;
ll ans_yoko=0,ans_tate=0;
//円の中心がy=1上にあって、横向きのものだけ
ll r_lim=(x-1)/2;//ちっちゃい円の半径
for(ll r=1;r<=r_lim;r++){
ans_yoko+=x-r*2;
ans_yoko%=m;
}
//cout<<ans_yoko<<endl;
ans_yoko*=y*2;
ans_yoko%=m;
//円の中心がx=1上にあって、縦向きのものだけ
r_lim=(y-1)/2;
rep(r,1,r_lim+1){
ans_tate+=y-r*2;
ans_tate%=m;
}
ans_tate*=x*2;
ans_tate%=m;
//cout<<ans_yoko<<" "<<ans_tate<<endl;
cout<<(ans_yoko+ans_tate)%m<<endl;
}
yamada