結果

問題 No.466 ジオラマ
ユーザー beetbeet
提出日時 2019-03-27 15:39:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,756 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 199,200 KB
最終ジャッジ日時 2025-01-07 00:33:22
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 70 RE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  auto NG=[](){cout<<-1<<endl;exit(0);};
  
  int n=a+b-c;

  using P = pair<int, int>;
  vector<P> vp;
  if(a==b){
    if(a==c){
      vp.emplace_back(1,0);
      for(int i=1;i<n;i++) vp.emplace_back(0,i);
      assert(0);
    }else{      
      int idx=2;
      if(c){
        vp.emplace_back(0,idx);
        vp.emplace_back(1,idx);
        idx++;
      }
      for(int i=1;i<c;i++) vp.emplace_back(2,idx++);
      for(int i=1;i<a-c;i++) vp.emplace_back(0,idx++);
      for(int i=1;i<b-c;i++) vp.emplace_back(1,idx++);
    }
  }else{
    if(min(a,b)==c){
      if(a<b){
        vp.emplace_back(1,0);
        int idx=2;
        for(int i=1;i<a;i++) vp.emplace_back(0,idx++);
        for(int i=1;i<b-a;i++) vp.emplace_back(1,idx++);
      }else{
        vp.emplace_back(0,1);     
        int idx=2;
        for(int i=1;i<b;i++) vp.emplace_back(1,idx++);
        for(int i=1;i<a-b;i++) vp.emplace_back(0,idx++); 
      }
    }else{
      int idx=2;
      if(c){
        vp.emplace_back(0,idx);
        vp.emplace_back(1,idx);
        idx++;
      }
      for(int i=1;i<c;i++) vp.emplace_back(2,idx++);
      for(int i=1;i<a-c;i++) vp.emplace_back(0,idx++);
      for(int i=1;i<b-c;i++) vp.emplace_back(1,idx++);
    }    
  }
  if((int)vp.size()>d) NG();
  cout<<n<<" "<<vp.size()<<"\n";
  for(auto p:vp) cout<<p.first<<" "<<p.second<<"\n";
  cout<<flush;
  return 0;
}
0