結果

問題 No.466 ジオラマ
ユーザー Hoi_koroHoi_koro
提出日時 2016-12-18 01:29:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 2,531 bytes
コンパイル時間 957 ms
コンパイル使用メモリ 112,196 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 00:22:39
合計ジャッジ時間 5,822 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 14 ms
4,376 KB
testcase_07 AC 10 ms
4,380 KB
testcase_08 AC 21 ms
4,376 KB
testcase_09 AC 13 ms
4,376 KB
testcase_10 AC 15 ms
4,376 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 17 ms
4,380 KB
testcase_13 AC 10 ms
4,380 KB
testcase_14 AC 8 ms
4,376 KB
testcase_15 AC 12 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 10 ms
4,376 KB
testcase_18 AC 11 ms
4,376 KB
testcase_19 AC 12 ms
4,380 KB
testcase_20 AC 11 ms
4,376 KB
testcase_21 AC 11 ms
4,380 KB
testcase_22 AC 14 ms
4,380 KB
testcase_23 AC 11 ms
4,380 KB
testcase_24 AC 17 ms
4,376 KB
testcase_25 AC 19 ms
4,380 KB
testcase_26 AC 11 ms
4,376 KB
testcase_27 AC 19 ms
4,380 KB
testcase_28 AC 15 ms
4,376 KB
testcase_29 AC 19 ms
4,376 KB
testcase_30 AC 15 ms
4,380 KB
testcase_31 AC 14 ms
4,376 KB
testcase_32 AC 13 ms
4,376 KB
testcase_33 AC 12 ms
4,376 KB
testcase_34 AC 14 ms
4,376 KB
testcase_35 AC 13 ms
4,376 KB
testcase_36 AC 7 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 9 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 12 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 12 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 11 ms
4,380 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 5 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 14 ms
4,376 KB
testcase_49 AC 1 ms
4,376 KB
testcase_50 AC 13 ms
4,376 KB
testcase_51 AC 2 ms
4,376 KB
testcase_52 AC 13 ms
4,376 KB
testcase_53 AC 2 ms
4,380 KB
testcase_54 AC 11 ms
4,376 KB
testcase_55 AC 2 ms
4,376 KB
testcase_56 AC 4 ms
4,380 KB
testcase_57 AC 1 ms
4,376 KB
testcase_58 AC 3 ms
4,376 KB
testcase_59 AC 1 ms
4,376 KB
testcase_60 AC 6 ms
4,376 KB
testcase_61 AC 2 ms
4,376 KB
testcase_62 AC 5 ms
4,376 KB
testcase_63 AC 1 ms
4,376 KB
testcase_64 AC 4 ms
4,376 KB
testcase_65 AC 1 ms
4,376 KB
testcase_66 AC 15 ms
4,376 KB
testcase_67 AC 2 ms
4,376 KB
testcase_68 AC 12 ms
4,376 KB
testcase_69 AC 2 ms
4,376 KB
testcase_70 AC 9 ms
4,376 KB
testcase_71 AC 1 ms
4,380 KB
testcase_72 AC 7 ms
4,380 KB
testcase_73 AC 1 ms
4,376 KB
testcase_74 AC 13 ms
4,380 KB
testcase_75 AC 1 ms
4,380 KB
testcase_76 AC 1 ms
4,380 KB
testcase_77 AC 1 ms
4,376 KB
testcase_78 AC 1 ms
4,376 KB
testcase_79 AC 1 ms
4,380 KB
testcase_80 AC 2 ms
4,376 KB
testcase_81 AC 1 ms
4,376 KB
testcase_82 AC 1 ms
4,376 KB
testcase_83 AC 2 ms
4,376 KB
testcase_84 AC 15 ms
4,376 KB
testcase_85 AC 29 ms
4,376 KB
testcase_86 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define dump(a) cerr<<#a <<' '<< a <<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d,n,m;
    cin >> a >> b >> c >> d;
    if(a==1 and b==1 and c==1 ){
        cout << -1 <<endl;
        return 0;
    }
    n=a+b-c;
    if(c==0)m=n-2;
    else m=n-1;
    if(a==c and b==c)++m;

    if(m>d){
        cout << -1 << endl;
    }else{
        cout << n <<' '<< m<<endl;;
        if(b==c and a!=c){
            cout << 0 <<' '<< 1 <<endl;
            FOR(i,2,2+c-1){
                cout << 1 << ' '<<i<<endl;
            }
            FOR(i,c+1,n){
                cout << 0 << ' '<<i <<endl;
            }
        }
        if(b==c and a==c){
            cout << 0 << ' '<<1 <<endl;
            cout << 1 << ' '<<0 <<endl;
            FOR(i,2,2+c-2){
                cout << 0 << ' '<<i << endl;
            }
        }
        if(b!=c and a!=c){
            REP(i,a-c-1){
                cout << 0 <<' '<< i+2 <<endl;
            }
            REPN(i,a-c+1,b-c-1){
                cout << 1 <<' '<< i <<endl;
            }
            if(c != 0){
                cout << 0 <<' '<< a+b-c*2<<endl;
                cout << 1 <<' '<< a+b-c*2<<endl;
                REPN(i,a+b-c*2,c-1){
                    cout << i << ' '<<i+1 << endl;
                }
            }
        }
        if(b!=c and a== c){
            cout <<1<< ' '<<0 <<endl;
            FOR(i,2,2+c-1){
                cout << 0 <<' '<< i<<endl;
            }
            FOR(i,c+1,n){
                cout << 1 <<' '<< i <<endl;
            }

        }
    }





    return 0;
}

0