結果

問題 No.3012 岩井星人グラフ
ユーザー Hebiue
提出日時 2025-02-01 17:12:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 392 ms / 2,000 ms
コード長 1,169 bytes
コンパイル時間 4,784 ms
コンパイル使用メモリ 219,972 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-01 17:12:35
合計ジャッジ時間 13,557 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
#define bigmod 1000000007
#define P pair<ll,ll>
#define T tuple<ll,ll,ll>
#define nall(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()//逆順ソート
#define inf 2000000000000000000LL
#define mint modint998244353
#define mkp make_pair
#define mkt make_tuple
template<class X> using priority_minq = priority_queue<X, vector<X>, greater<X>>;//小さい順
ll min(ll a1,ll b1){if(a1>b1)return b1;else return a1;}
ll max(ll a1,ll b1){if(a1>b1)return a1;else return b1;}
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

//cout << fixed << setprecision(10); double型出力するときに使うやつ

int main(){
    ll n,m; cin >> n >> m;
    cout << n*m << " " << n*m << endl;
    ll cnt = 1;
    rep(i,n){
        rep(j,m-1){
            cout << cnt << " " << cnt+1 << endl;
            cnt++;
        }
        cnt++;
        if(i != n-1)cout << cnt-m << " " << cnt << endl;
        else cout << cnt-m << " 1" << endl;
    }
}
0