結果

問題 No.1257 変わった平均値
ユーザー fumofumofunifumofumofuni
提出日時 2020-10-16 23:24:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,350 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 186,284 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 00:01:58
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a <= b) {
a = b;
return true;
}
return false;
}
int main(){
vl v(3),f(3);
rep(i,3)cin >> v[i];rep(i,3)cin >> f[i];
vl vv=v,ff=f;
rep(i,3)vv[i]=abs(vv[i]);rep(i,3)ff[i]=abs(ff[i]);
sort(all(vv));sort(all(ff));
rep(i,3){
if(vv[i]!=ff[i])cout << "No" <<endl,exit(0);
}
cout << "Yes" <<endl;
if(v==f)cout << 2 <<endl,exit(0);
queue<pair<vl,string>> que;
que.push({v,""});
while(!que.empty()){
auto z=que.front();que.pop();
if(z.fi==f){
rep(i,z.se.size()){
if(z.se[i]=='2')cout << 2 <<endl;
else cout << 1 <<" " << (char)('A'-'a'+z.se[i]) <<endl;
}
return 0;
//cout << z.se <<endl;
}
vl k=z.fi;sort(all(k));
do{
que.push(make_pair(k,z.se+'2'));
}while(next_permutation(all(k)));
k=z.fi;
swap(k[0],k[1]);
k[0]*=-1;que.push(make_pair(k,z.se+"cc"));k[0]*=-1;
k[1]*=-1;que.push(make_pair(k,z.se+"cc"));
k=z.fi;
swap(k[0],k[2]);
k[0]*=-1;que.push(make_pair(k,z.se+"bb"));k[0]*=-1;
k[2]*=-1;que.push(make_pair(k,z.se+"bb"));
k=z.fi;
swap(k[1],k[2]);
k[1]*=-1;que.push(make_pair(k,z.se+"aa"));k[1]*=-1;
k[2]*=-1;que.push(make_pair(k,z.se+"aa"));
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0