結果
| 問題 |
No.1500 Super Knight
|
| コンテスト | |
| ユーザー |
auaua
|
| 提出日時 | 2021-05-07 22:05:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,722 bytes |
| コンパイル時間 | 1,676 ms |
| コンパイル使用メモリ | 173,008 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 10:00:28 |
| 合計ジャッジ時間 | 2,776 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 WA * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=INF;
const ll inf=INF*INF;
const ll mod=MOD;
const ll MAX=100010;
set<pll>st;
void solve(pll now,ll i,ll n){
if(i==n){
st.insert(now);
return;
}
ll x=now.fi,y=now.se;
solve(mp(x+3,y),i+1,n);
solve(mp(x+3,y+2),i+1,n);
solve(mp(x+2,y+3),i+1,n);
solve(mp(x,y+3),i+1,n);
solve(mp(x-2,y+3),i+1,n);
solve(mp(x-3,y+2),i+1,n);
solve(mp(x-3,y),i+1,n);
solve(mp(x-3,y-2),i+1,n);
solve(mp(x-2,y-3),i+1,n);
solve(mp(x,y-3),i+1,n);
solve(mp(x+2,y-3),i+1,n);
solve(mp(x+3,y-2),i+1,n);
}
signed main(){
ll n;cin>>n;
if(n==1){
cout<<12<<endl;
}else if(n==2){
cout<<65<<endl;
}else if(n==3){
cout<<172<<endl;
}else if(n%2==0){
ll z=n*6LL+1;
ll ans=(z*z+1LL)%mod*500000004LL%mod;
ans=(ans-n/2LL*n/2LL%mod*4LL%mod)%mod;
if(ans<0)ans+=mod;
cout<<ans<<endl;
}else{
ll z=n*6LL+1;
ll b=n/2;
ll ans=(z*z%mod+1LL)%mod*500000004LL%mod;
ans=(ans-b*(b+1)%mod*4LL%mod-1LL)%mod;
if(ans<0)ans+=mod;
cout<<ans<<endl;
}
//solve(mp(0,0),0,n);
//cout<<st.size()<<endl;
}
auaua