結果

問題 No.1500 Super Knight
ユーザー auauaauaua
提出日時 2021-05-07 22:11:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,936 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 172,048 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-13 13:19:30
合計ジャッジ時間 2,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,356 KB
testcase_22 AC 1 ms
4,356 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 WA -
testcase_26 AC 1 ms
4,352 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 2 ms
4,356 KB
testcase_30 AC 1 ms
4,348 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 1 ms
4,352 KB
testcase_33 AC 1 ms
4,352 KB
testcase_34 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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%mod+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-1LL)%mod*500000004LL%mod;
        ans=(ans-b*(b+1)%mod*4LL%mod)%mod;
        if(ans<0)ans+=mod;
        cout<<ans<<endl;
    }
    //solve(mp(0,0),0,n);
    //cout<<st.size()<<endl;
    /* 
    rep(i,50){
        rep(j,50){
            if(st.find(mp(i-25,j-25))!=st.end()){
                cout<<1;
            }else{
                cout<<0;
            }
        }
        cout<<endl;
    }
    */
}
0