結果

問題 No.1257 変わった平均値
ユーザー abc3
提出日時 2020-10-16 23:46:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 2,582 ms
コンパイル使用メモリ 203,644 KB
最終ジャッジ日時 2025-01-15 10:16:15
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF=1001001001;
const int mod = 1000000007;

int main() {
  vector<int>p(3),q(3);
  cin>>p[0]>>p[1]>>p[2]>>q[0]>>q[1]>>q[2];
  vector<pair<int,int>>e(3);
  for(int i=0;i<3;i++){
    e[i]=make_pair(p[i],q[i]);
  }
  if(p[0]==p[1]&&p[1]==p[2]){cout<<"No"<<endl;return 0;}
  bool ok=true;
  for(int i=0;i<2;i++){
    if(p[i]!=q[i]&&p[i+1]!=q[i+1]){
      ok=false;
    }
  }
  if(!ok){
    cout<<2<<endl;
    sort(e.rbegin(),e.rend());
  }
  
  vector<int>k(3);
  for(int i=0;i<3;i++){
    while(p[i]<q[i]){
      p[i]*=2;
      k[i]++;
    }
    if(p[i]!=q[i]){cout<<"No"<<endl;return 0;}
  }
  int MAX=0,r=0,sum=0;
  for(int i=0;i<3;i++){
    sum+=k[i];
    if(MAX<k[i]){MAX=k[i];r=i;}
  }
  if(sum-MAX!=MAX){cout<<"No"<<endl;return 0;}

  for(int i=0;i<2;i++){
    if(k[i]==0){continue;}
    for(int j=0;j<k[i];j++){
      if(k[i+1]>0){
        int c=3;  
        cout<<1<<" "<<c<<endl<<1<<" "<<c<<endl;
        k[i+1]--;
      }
      else if(i==0&&k[i+2]>0){
        int c=2; 
        cout<<1<<" "<<c<<endl<<1<<" "<<c<<endl;
        k[i+2]--;
      }
    }
  }
  return 0;
}
0