結果
問題 | No.466 ジオラマ |
ユーザー |
![]() |
提出日時 | 2016-12-16 00:33:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,817 bytes |
コンパイル時間 | 1,127 ms |
コンパイル使用メモリ | 98,252 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-30 09:12:29 |
合計ジャッジ時間 | 10,355 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 33 WA * 50 |
ソースコード
// #includes {{{ #include <algorithm> #include <numeric> #include <iostream> #include <string> #include <vector> #include <queue> #include <list> #include <deque> #include <stack> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cassert> #include <cstring> #include <cmath> using namespace std; // }}} // pre-written code {{{ #define REP(i,n) for(int i=0;i<(int)(n);++i) #define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i) #define LET(x,a) __typeof(a) x(a) //#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i) #define ALL(c) (c).begin(), (c).end() #define MP make_pair #define EXIST(e,s) ((s).find(e)!=(s).end()) #define RESET(a) memset((a),0,sizeof(a)) #define SET(a) memset((a),-1,sizeof(a)) #define PB push_back #define DEC(it,command) __typeof(command) it=command //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl; const int INF=0x3f3f3f3f; typedef long long Int; typedef unsigned long long uInt; #ifdef __MINGW32__ typedef double rn; #else typedef long double rn; #endif typedef pair<int,int> pii; /* #ifdef MYDEBUG #include"debug.h" #include"print.h" #endif */ // }}} int N; int A,B,C,D; int main(){ vector<int> a,b,c; cin>>A>>B>>C>>D; if(A==C and B==C){ if(D<A){ cout<<-1<<endl; }else{ cout<<A<<" "<<A<<endl; REP(i,A){ cout<<i<<" "<<(i+1)%A<<endl; } } return 0; }else if(A==C){ c.push_back(0); int t = 2; REP(i,C-1)c.push_back(t++); b.push_back(1); REP(j,B-C-1)b.push_back(t++); }else if(B==C){ c.push_back(1); int t = 2; REP(i,C-1)c.push_back(t++); a.push_back(0); REP(j,A-C-1)a.push_back(t++); }else{ int t = 2; a.push_back(0); REP(i,A-C-1){ a.push_back(t++); } b.push_back(1); REP(j,B-C-1){ b.push_back(t++); } REP(k,C){ c.push_back(t++); } } N = (int)a.size()+(int)b.size()+(int)c.size()+5; vector<pii> e; REP(i,a.size()){ if(i+1<a.size())e.push_back(make_pair(a[i],a[i+1])); } REP(i,b.size()){ if(i+1<b.size())e.push_back(make_pair(b[i],b[i+1])); } if(a.size()>0 and c.size()>0)e.push_back(make_pair(a.back(),c.front())); if(b.size()>0 and c.size()>0)e.push_back(make_pair(b.back(),c.front())); REP(i,c.size()){ if(i+1<c.size())e.push_back(make_pair(c[i],c[i+1])); } if(D<e.size()){ // if(false){ cout<<-1<<endl; }else{ cout<<N<<" "<<e.size()<<endl; REP(i,e.size()){ cout<<e[i].first<<" "<<e[i].second<<endl; assert(0<=e[i].first and e[i].first<N and 0<=e[i].second and e[i].second<N); } } return 0; }