結果

問題 No.1880 Many Ways
ユーザー auauaauaua
提出日時 2022-03-18 23:28:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,708 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 169,300 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 11:44:21
合計ジャッジ時間 15,970 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <unordered_set>
#include <random>
//#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=998244353;
const ll inf=INF*INF;
const ll mod=INF;
const ll MAX=100010;
const double PI=acos(-1.0);
typedef vector<vector<ll> > mat;
typedef vector<ll> vec;
double pi=M_PI;


void solve(){
    ll a;cin>>a;
    vector<vector<ll> >G(119);
    ll m=0;
    REP(i,1,39){
        G[i*3].pb(i*3+3);
        m++;
    }
    G[0].pb(1),G[0].pb(2);
    m+=2;
    rep(i,38){
        G[i*3+1].pb(i*3+4);
        G[i*3+1].pb(i*3+5);
        G[i*3+2].pb(i*3+4);
        G[i*3+2].pb(i*3+5);
        m+=4;
    }
    if(a%2){
        G[0].pb(3);
        m++;
    }
    rep(j,39){
        if((1LL<<(j+1))&a){
            if(j<38){
                G[j*3+1].pb(j*3+6);
                G[j*3+2].pb(j*3+6);
            }else{
                G[j*3+1].pb(118);
                G[j*3+2].pb(118);
            }
            m+=2;
        }
    }
    G[117].pb(118);
    m++;
    m++;
    cout<<120<<' '<<m<<endl;
    cout<<1<<' '<<2<<endl;
    rep(i,119){
        rep(j,G[i].size()){
            cout<<i+2<<' '<<G[i][j]+2<<endl;
        }
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}
0