text
stringlengths
49
983k
# define _CRT_SECURE_NO_WARNINGS 1 # define _USE_MATH_DEFINES # include <iostream> # include <numeric> # include <string> # include <bitset> # include <vector> # include <algorithm> # include <cstdlib> # include <cstdio> # include <cstring> # include <cstdlib> # include <iomanip> # include <queue> # include <sstream> # include <climits> # include <cmath> # include <list> # include <functional> # include <string> # include <ctime> # include <set> # include <forward_list> # include <map> # include <stack> using namespace std; # define INF ((int)(1<<25)) # define REP(i,n) for(int i=0;i<(int)n;i++) # define FOR(i,n) REP(i,n) # define TORAD 2.0*M_PI/360.0 # define INT(x) int x;cin>>x; # define ALL(x) (x).begin(),(x).end() # define RALL(x) (x).rbegin(),(x).rend() # define DEBUG(x) cout<<#x<<" :"<<x<<endl; # define EPS 1e-12 template<class T> void debug(T a) { for (auto iiiiiiiiii : a)cout << iiiiiiiiii << endl; } typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<int, pii> piii; int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 }; int main() { int n[2]; while (cin >> n[0]&&n[0]) { int t[2]; int h, m; cin >> h >> m; t[0] = h * 60 + m; cin >> n[1]; cin >> h >> m; t[1] = h * 60 + m; int x[][8] = { {0,0,0,0,0,0,0,0},{0,0,300,500,600,700,1350,1650},{0,0,0,350,450,600,1150,1500},{0,0,0,0,250,400,1000,1350},{0,0,0,0,0,250,850,1300},{0,0,0,0,0,0,600,1150},{0,0,0,0,0,0,0,500} }; int ans = x[min(n[0], n[1])][max(n[0], n[1])]; int p = 0; if (17 * 60 + 30 <= t[0] && t[0] <= 19 * 60 + 30)p++; if (17 * 60 + 30 <= t[1] && t[1] <= 19 * 60 + 30)p++; int d[] = { 6,7,5,5,20,15 }; int D = 0; if (n[0] > n[1])swap(n[0], n[1]); while (n[0] < n[1]) { D += d[n[0]-1]; n[0]++; } if (p && D <= 40) { ans /= 2; while (ans % 50)ans++; } cout << ans << endl; } }
#include<iostream> #include<algorithm> #include<vector> #include<queue> #define lol(i,n) for(int i=0;i<n;i++) #define mod 1000000007 typedef long long ll; using namespace std; int d[7][7]={ {0,300,500,600,700,1350,1650}, {6,0,350,450,600,1150,1500}, {13,7,0,250,400,1000,1350}, {18,12,5,0,250,850,1300}, {23,17,10,5,0,600,1150}, {43,37,30,25,20,0,500}, {58,52,45,40,35,15,0} }; int main(){ int a,b,h1,h2,m1,m2; while(cin>>a&&a){ cin>>h1>>m1>>b>>h2>>m2; m1+=h1*100,m2+=h2*100; a--,b--; if(a>b)swap(a,b); int tmp=d[a][b]; if(d[b][a]<=40&&((1730<=m1&&m1<=1930)||(1730<=m2&&m2<=1930)))tmp/=2; if(tmp%50>0)tmp+=50-tmp%50; cout<<tmp<<endl; } return 0; }
#include <iostream> using namespace std; int main(){ int sic,sh,sm,eic,eh,em,st,et,S,E,flag,ans; int d[8][8]; bool c[8][8]; d[1][2]=d[2][1]=300; d[1][3]=d[3][1]=500; d[1][4]=d[4][1]=600; d[1][5]=d[5][1]=700; d[1][6]=d[6][1]=1350; d[1][7]=d[7][1]=1650; d[2][3]=d[3][2]=350; d[2][4]=d[4][2]=450; d[2][5]=d[5][2]=600; d[2][6]=d[6][2]=1150; d[2][7]=d[7][2]=1500; d[3][4]=d[4][3]=250; d[3][5]=d[5][3]=400; d[3][6]=d[6][3]=1000; d[3][7]=d[7][3]=1350; d[4][5]=d[5][4]=250; d[4][6]=d[6][4]=850; d[4][7]=d[7][4]=1300; d[5][6]=d[6][5]=600; d[5][7]=d[7][5]=1150; d[6][7]=d[7][6]=500; S=17*3600+30*60; E=19*3600+30*60; for(int i=1;i<8;i++) for(int j=1;j<8;j++) c[i][j]=true; c[1][6]=c[6][1]=false; c[3][7]=c[7][3]=false; c[2][7]=c[7][2]=false; c[1][7]=c[7][1]=false; while(1){ cin>>sic>>sh>>sm>>eic>>eh>>em; if(!sic) break; st=sh*3600+sm*60; et=eh*3600+em*60; flag=0; if((S<=st&&st<=E)||(S<=et&&et<=E)) flag=1; ans=d[sic][eic]; if(flag&&c[sic][eic]){ int cal; ans/=2; cal=ans%100; if(cal%50){ ans/=100; ans*=100; if(cal<50) ans+=50; else ans+=100; } } cout<<ans<<endl; } return 0; }
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> //#include <utility> #include <set> #include <iostream> //#include <memory> #include <string> #include <vector> #include <algorithm> //#include <functional> #include <sstream> //#include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> //#include <cctype> #include <cstring> //#include <ctime> #include <iterator> #include <bitset> //#include <numeric> //#include <list> //#include <iomanip> #if __cplusplus >= 201103L #include <array> #include <tuple> #include <initializer_list> #include <unordered_set> #include <unordered_map> #include <forward_list> #define cauto const auto& #else #endif using namespace std; namespace{ typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define reep(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reep((i),0,(n)) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define F first #define S second #define mkp make_pair #define RALL(v) (v).rbegin(),(v).rend() #define MOD 1000000007LL #define EPS 1e-8 static const int INF=1<<24; void mainmain(){ int n1,n2; int a[7][7]={ {0,6,13,18,23,43,58}, {300,0,7,12,17,37,52}, {500,350,0,5,10,30,45}, {600,450,250,0,5,25,40}, {700,600,400,250,0,20,35}, {1350,1150,1000,850,600,0,15}, {1650,1500,1350,1300,1150,500} }; while(cin>>n1,n1){ int m1,s1,m2,s2; cin>>m1>>s1; cin>>n2; cin>>m2>>s2; bool f1=false; bool f2=false; int t1=m1*60+s1; int t2=m2*60+s2; if(17*60+30<=t1&&t1<=19*60+30) f1=true; if(17*60+30<=t2&&t2<=19*60+30) f1=true; if(a[min(n1,n2)-1][max(n1,n2)-1]<=40) f2=true; if(f1&&f2){ int ans=a[max(n1,n2)-1][min(n1,n2)-1]; if(ans%100==0) cout<<ans/2<<endl; else{ ans+=50; cout<<ans/2<<endl; } } else{ cout<<a[max(n1,n2)-1][min(n1,n2)-1]<<endl; } } } } int main() try{ mainmain(); } catch(...){ }
#include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <stack> #include <vector> #include <map> #include <set> #include <queue> #include <list> #include <iostream> #include <sstream> #include <climits> #include <cfloat> #include <complex> using namespace std; int main() { int distance[][7] = { { 0, 6, 13, 18, 23, 43, 58 }, { 0, 0, 7, 12, 17, 37, 52 }, { 0, 0, 0, 5, 10, 30, 45 }, { 0, 0, 0, 0, 5, 25, 40 }, { 0, 0, 0, 0, 0, 20, 35 }, { 0, 0, 0, 0, 0, 0, 15 } }; int charge[][7] = { { 0, 300, 500, 600, 700, 1350, 1650 }, { 0, 0, 350, 450, 600, 1150, 1500 }, { 0, 0, 0, 250, 400, 1000, 1350, }, { 0, 0, 0, 0, 250, 850, 1300 }, { 0, 0, 0, 0, 0, 600, 1150 }, { 0, 0, 0, 0, 0, 0, 500 } }; int n, m, s, e; while (scanf("%d", &n), n) { int a, b; scanf("%d %d", &a, &b); s = 60*a + b; scanf("%d %d %d", &m, &a, &b); e = 60*a + b; --n; --m; if (n > m) swap(n, m); int d = distance[n][m]; int c = charge[n][m]; const int S = 60*17 + 30; const int E = 60*19 + 30; if (d <= 40 && (S <= s && s <= E || S <= e && e <= E)) c = (c+50)/100*50; printf("%d\n", c); } return 0; }
#include <iostream> #include <fstream> // require freopen using namespace std; int main() { int price[][7] = { { 0, 300, 500, 600, 700,1350,1650 }, { 0, 0, 350, 450, 600,1150,1500 }, { 0, 0, 0, 250, 400,1000,1350 }, { 0, 0, 0, 0, 250, 850,1300 }, { 0, 0, 0, 0, 0, 600,1150 }, { 0, 0, 0, 0, 0, 0, 500 }, { 0, 0, 0, 0, 0, 0, 0 } }; int dist[][7] = { { 0, 0, 0, 0, 0, 0, 0 }, { 6, 0, 0, 0, 0, 0, 0 }, { 13, 7, 0, 0, 0, 0, 0 }, { 18, 12, 5, 0, 0, 0, 0 }, { 23, 17, 10, 5, 0, 0, 0 }, { 43, 37, 30, 25, 20, 0, 0 }, { 58, 52, 45, 40, 35, 15, 0 } }; for (int i = 0; i < 7; ++i ){ for (int j = 0; j < 7; ++j ){ if (i != j ){ if (price[i][j] == 0 ){ price[i][j] = price[j][i]; } // end if if (dist[i][j] == 0 ){ dist[i][j] = dist[j][i]; } // end if } // end if } // en for } // end for // cut here before submit // freopen ("testcase.highwaytoll", "r", stdin ); int from; while (cin >> from && from ){ int fromh, fromm; cin >> fromh >> fromm; int to,toh, tom; cin >> to >> toh >> tom; from--;to--; int res = 0; int em = fromh*60 + fromm; int dm = toh*60 + tom; // ツ環暗クツ妥篠湘崢づ個篠楪甘板妥堕づづ債づ按つ「 if ( (17*60 + 30 <= em && em <= 19*60 + 30 ) || (17*60 + 30 <= dm && dm <= 19*60 + 30 ) ){ int d = dist[from][to]; if (d > 40 ){ res = price[from][to]; }else{ res = (price[from][to]/2 + 49)/50*50; } // end if }else{ res = price[from][to]; } // end if cout << res << endl; } // end loop return 0; }
#include<iostream> using namespace std; int T[7][7]={ {-1,300,500,600,700,1350,1650}, {6,-1,350,450,600,1150,1500}, {13,7,-1,250,400,1000,1350}, {18,12,5,-1,250,850,1300}, {23,17,10,5,-1,600,1150}, {43,37,30,25,20,-1,500}, {58,52,45,40,35,15} }; int main() { int A; while(cin>>A,A) { int h,m;cin>>h>>m;m+=h*60; int B,m2;cin>>B>>h>>m2;m2+=h*60; if(A>B)A^=B^=A^=B; A--,B--; bool flag=T[B][A]<=40; if(!(1050<=m&&m<=1170||1050<=m2&&m2<=1170))flag=false; int ans=T[A][B]; if(flag)ans>>=1; while(ans%50)ans++; cout<<ans<<endl; } }
#include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <queue> #include <cstring> #include <deque> #include <cstdio> #include <cmath> #include <complex> #include <iostream> #include <iterator> using namespace std; #define reep(i,f,t) for(int i=f ; i<int(t) ; ++i) #define rep(i,n) reep(i, 0, n) typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; int main() { const int fare[7][7] = { {0, 300, 500, 600, 700, 1350, 1650}, {0, 0, 350, 450, 600, 1150, 1500}, {0, 0, 0, 250, 400, 1000, 1350}, {0, 0, 0, 0, 250, 850, 1300}, {0, 0, 0, 0, 0, 600, 1150}, {0, 0, 0, 0, 0, 0, 500} }; const int dist[7] = {0, 6, 13, 18, 23, 43, 58}; int s; while(scanf("%d", &s), s){ int h, m; scanf("%d%d", &h, &m); int t = h*60 + m; bool half = 17*60+30 <= t && t <= 19*60+30; int g; scanf("%d%d%d", &g, &h, &m); t = h*60 + m; half |= 17*60+30 <= t && t <= 19*60+30; s--; g--; half &= dist[max(s, g)] - dist[min(s, g)] <= 40; int cost = fare[min(s, g)][max(s, g)]; if(half) cost = (cost + 99) / 100 * 50; printf("%d\n", cost); } return 0; }
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <functional> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <deque> #include <ctime> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define pb push_back //#define mp make_pair #define all(r) r.begin(),r.end() #define rall(r) r.rbegin(),r.rend() #define fi first #define se second #define println(X) cout<<X<<endl; #define DBG(X) cout<<#X<<" : "<<X<<endl; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll MOD = 1e9 + 7; double EPS = 1e-8; const double PI = acos(-1); int dist[7][7]={ {}, {6}, {13, 7}, {18, 12, 5}, {23, 17, 10, 5}, {43, 37, 30, 25, 20}, {58, 52, 45, 40, 35, 15} }; int cost[7][7]{ {0, 300, 500, 600, 700, 1350, 1650}, {0, 0,350, 450, 600, 1150, 1500}, {0, 0, 0,250, 400, 1000, 1350}, {0, 0, 0,0,250, 850, 1300}, {0,0,0,0,0,600, 1150}, {0,0,0,0,0,0,500}, {} }; int main(){ int a, b; int s, t; int h, m; while(cin>>a && a){ cin>>h>>m; s = h * 60 + m; cin>>b>>h>>m; t = h *60 + m; a--; b--; if(a> b) swap(a, b); bool f = true; if(dist[b][a] > 40) f=false; if(f&&((s>=17*60+30&&s<=19*60+30)||(t>=17*60+30&&t<=19*60+30))){ int ans = cost[a][b]; cout<<(cost[a][b]/100)/2*100+(cost[a][b]%100==50?50:0)+((cost[a][b]/100)%2==1?50:0)<<endl; } else{ cout<<cost[a][b]<<endl; } //cout<<a<<" "<<b<<endl; } }
#include<iostream> #include<cmath> #include<cstdlib> using namespace std; int l[7]={0,6,13,18,23,43,58}; int co[7][7]={ 0,300,500,600,700,1350,1650, 300,0,350,450,600,1150,1500, 500,350,0,250,400,1000,1350, 600,450,250,0,250,850,1300, 700,600,400,250,0,600,1150, 1350,1150,1000,850,600,0,500, 1650,1500,1350,1300,1150,500,0 }; int main(void){ int s[2],h[2],m[2]; int f[2]; int ans; while(1){ scanf("%d",&s[0]); if(s[0]==0)break; scanf("%02d%02d",&h[0],&m[0]); scanf("%d",&s[1]); scanf("%02d%02d",&h[1],&m[1]); for(int i=0;i<2;i++){ if(h[i]<17 || h[i]==17 && m[i]<30)f[i]=0; else if(h[i]<19 || h[i]==19 && m[i]<=30)f[i]=1; else f[i]=2; } ans=co[s[0]-1][s[1]-1]; if((f[0]==1 || f[1]==1) && abs(l[s[1]-1]-l[s[0]-1])<=40)ans=(co[s[0]-1][s[1]-1]+50)/100*50; printf("%d\n",ans); } return 0; }
#include <iostream> #include <memory> #include <memory.h> #include <cmath> #include <fstream> #include <cmath> #include <numeric> #include <vector> #include <stack> #include <string> #include <queue> #include <sstream> #include <cstdlib> #include <cassert> #include <cstdio> #include <map> #include <iomanip> #include <list> #include <cctype> #include <algorithm> #include <complex> #define USE_MATH_DEFINES #define rep(i, n) for(int i = 0; i < n; i++) #define rep2(i, m, n) for(int i = m; i < n; i++) using namespace std; typedef complex<double> xy_t; typedef pair<xy_t, xy_t> line; typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> PP; typedef pair<int, PP> PPP; const int INF = 1 << 29; const double EPS = 1E-10; int table[][7] = { {0, 300, 500, 600, 700, 1350, 1650}, {6, 0, 350, 450, 600, 1150, 1500}, {13, 7, 0, 250, 400, 1000, 1350}, {13, 12, 5, 0, 250, 850, 1300}, {23, 17, 10, 5, 0, 600, 1150}, {43, 37, 30, 25, 20, 0, 500}, {58, 52, 45, 40, 35, 15, 0} }; int main(){ int s, t; int h1, m1, h2, m2; int t1, t2; while(cin >> s && s){ cin >>h1 >> m1; cin >> t; cin >> h2 >> m2; t1 = h1 * 60 + m1; t2 = h2 * 60 + m2; s--, t--; int cost = table[min(s, t)][max(s, t)]; int dis = table[max(s, t)][min(s, t)]; if(dis <= 40 && (1050 <= t1 && t1 <= 1170 || 1050 <= t2 && t2 <= 1170)){ cost = (cost / 2 + 49) / 50 * 50; } cout << cost << endl; } return 0; }
#include <iostream> #include <algorithm> using namespace std; int main(){ int s,g,h,m,t,price; bool flag; int table[7][7]={ {0 ,300,500,600,700,1350,1650}, {6 ,0 ,350,450,600,1150,1500}, {13,7 ,0 ,250,400,1000,1350}, {18,12 ,5 ,0 ,250,850 ,1300}, {23,17 ,10 ,5 ,0 ,600 ,1150}, {43,37 ,30 ,25 ,20 ,0 ,500 }, {58,52 ,45 ,40 ,35 ,15 ,0 } }; while(cin >> s && s){ flag = false; cin >> h >> m ; t = h*60 + m; if(t >= 17*60+30 && t <= 19*60+30){ flag = true; } cin >> g; cin >> h >> m ; t = h*60 + m; if(t >= 17*60+30 && t <= 19*60+30){ flag = true; } s--;g--; if(g>s)swap(s,g); price = table[g][s]; if(flag && table[s][g]<= 40){ price /=2; if(price%50){ price = price - price%50 + 50; } } cout << price << endl; } }
#include<iostream> using namespace std; struct Point{ int t, p;}; int T[8][8] = {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 300, 500, 600, 700, 1350, 1650}, {0, 6, 0, 350, 450, 600, 1150, 1500}, {0, 13, 7, 0, 250, 400, 1000, 1350}, {0, 18, 12, 5, 0, 250, 850, 1300}, {0, 23, 17, 10, 5, 0, 600, 1150}, {0, 43, 37, 30, 25, 20, 0, 500}, {0, 58, 52, 45, 40, 35, 15,0}}; int main(){ Point s, d; int cost, h, m; while(1){ cin >> s.p; if ( s.p == 0 ) break; cin >> h >> m; s.t = h*60 + m; cin >> d.p; cin >> h >> m; d.t = h*60 + m; cost = T[s.p][d.p]; if ( 1050 <= s.t && s.t <= 1170 || 1050 <= d.t && d.t <= 1170 ){ if ( T[d.p][s.p] <= 40 ) cost /= 2; } if ( cost % 50 ) cost += 25; cout << cost << endl; } }
#include <iostream> #include <cmath> using namespace std; int dist[] = {0, 6, 13, 18, 23, 43, 58}; int cost[][7] = { { 0, 300, 500, 600, 700, 1350, 1650}, { 300, 0, 350, 450, 600, 1150, 1500}, { 500, 350, 0, 250, 400, 1000, 1350}, { 600, 450, 250, 0, 250, 850, 1300}, { 700, 600, 400, 250, 0, 600, 1150}, {1350, 1150, 1000, 850, 600, 0, 500}, {1650, 1500, 1350, 1300, 1150, 500, 0},}; int main() { int s, g; while(cin >> s, s) { int h, m; bool half = false; cin >> h >> m; if(17 * 60 + 30 <= h * 60 + m && h * 60 + m <= 19 * 60 + 30) half = true; cin >> g >> h >> m; if(17 * 60 + 30 <= h * 60 + m && h * 60 + m <= 19 * 60 + 30) half = true; half &= abs(dist[s-1] - dist[g-1]) <= 40; if(half) cout << ((cost[s-1][g-1] / 50) + 1) / 2 * 50 << endl; else cout << cost[s-1][g-1] << endl; } }
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) int info[7][7] = { {0, 300, 500, 600, 700, 1350, 1650}, {6, 0, 350, 450, 600, 1150, 1500}, {13, 7, 0, 250, 400, 1000, 1350}, {18, 12, 5, 0, 250, 850, 1300}, {23, 17, 10, 5, 0, 600, 1150}, {43, 37, 30, 25, 20, 0, 500}, {58, 52, 45, 40, 35, 15, 0} }; int main() { int s, st, e, et; while (cin >> s, s) { int h, m; cin >> h >> m; st = h * 60 + m; cin >> e; cin >> h >> m; et = h * 60 + m; s--; e--; int ans = info[s][e]; if (st >= 17*60 + 30 && st <= 19*60 + 30 || et >= 17*60 + 30 && et <= 19*60 + 30) { if (info[e][s] <= 40) ans = ans % 100 == 0 ? ans / 2 : (ans + 100) / 2 - (ans / 2 % 50); } cout << ans << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int T[8][8] = { {0,0,0,0,0,0,0,0}, {0,0,300,500,600,700,1350,1650}, {0,6,0,350,450,600,1150,1500}, {0,13,7,0,250,400,1000,1350}, {0,18,12,5,0,250,850,1300}, {0,23,17,10,5,0,600,1150}, {0,43,37,30,25,20,0,500}, {0,58,52,45,40,35,15}, }; const int h_begin = 17*60 + 30; const int h_end = 19*60 + 30; int main() { int s, sh, sm, t, th, tm; while(cin >> s && s) { cin >> sh >> sm; cin >> t; cin >> th >> tm; int a = s, b = t; if(a > b) swap(a, b); int cost = T[a][b]; int dist = T[b][a]; int in = sh * 60 + sm; int out = th * 60 + tm; if(dist <= 40 && (h_begin <= in && in <= h_end || h_begin <= out && out <= h_end) ) { cost /= 2; while(cost % 50) ++cost; } cout << cost << endl; } return 0; }
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <cassert> #include <iostream> #include <cctype> #include <sstream> #include <string> #include <list> #include <vector> #include <queue> #include <set> #include <stack> #include <map> #include <utility> #include <numeric> #include <algorithm> #include <iterator> #include <bitset> #include <complex> #include <fstream> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<int> vint; typedef pair<int, int> pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); } template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; } template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); } int table[8][8] = { {-1, 300, 500, 600, 700, 1350, 1650}, {6, -1, 350, 450, 600, 1150, 1500}, {13, 7, -1, 250, 400, 1000, 1350}, {18, 12, 5, -1, 250, 850, 1300}, {23, 17, 10, 5, -1, 600, 1150}, {43, 37, 30, 25, 20, -1, 500}, {58, 52, 45, 40, 35, 15, -1} }; bool yes(int h, int t) { if(h == 17) return 30 <= t; if(h == 18) return true; if(h == 19) return t <= 30; return false; } int main() { int s, t, sh, st, th, tt; while(cin >> s && s) { cin >> sh >> st >> t >> th >> tt; int charge = table[s-1][t-1]; if(table[t-1][s-1] <= 40 && (yes(sh, st) || yes(th, tt))) { charge /= 2; cout << charge + (charge % 50 != 0 ? 25 : 0) << endl; } else { cout << charge << endl; } } }
#include <iostream> #include <algorithm> #include <cmath> using namespace std; int fee[7][7] = { {0, 300, 500, 600, 700, 1350, 1650}, {300, 0, 350, 450, 600, 1150, 1500}, {500, 350, 0, 250, 400, 1000, 1350}, {600, 450, 250, 0, 250, 850, 1300}, {700, 600, 400, 250, 0, 600, 1150}, {1350, 1150, 1000, 800, 600, 0, 500 }, {1650, 1500, 1350, 1300, 1150, 500, 0 } }; int dist[7][7] = { {0, 6, 13, 18, 23, 43, 58}, {6, 0, 7, 12, 17, 37, 52}, {13, 7, 0, 5, 10, 30, 45}, {18, 12, 5, 0, 5, 25, 40}, {23, 17, 10, 5, 0, 20, 35}, {43, 37, 30, 25, 20, 0, 15}, {58, 52, 45, 40, 35, 15, 0} }; bool isHalf(int dst, int s, int t) { int const LIM_L = 17*60+30; int const LIM_U = 19*60+30; if(dst > 40) return false; if( (LIM_L <= s && s <= LIM_U) || (LIM_L <= t && t <= LIM_U) ) return true; return false; } int main() { while(1) { int s, h, m; cin >> s >> h >> m; if(s == 0) break; int stime = h*60 + m; int d; cin >> d >> h >> m; int dtime = h*60 + m; int dst = dist[s-1][d-1]; if(isHalf(dst, stime, dtime)) { cout << ceil(fee[s-1][d-1]/50/2.0)*50 << endl; } else cout << fee[s-1][d-1] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int dx[]={0,1,0,-1,1,-1,-1,1}; const int dy[]={-1,0,1,0,1,1,-1,-1}; const int INF = 1<<30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i,j,k) for(int i = (j); i < (k); i++) #define rep(i,j) reps(i,0,j) #define MOD 1000000007 typedef pair<int,int> Pii; typedef pair<int,Pii> P; typedef vector<int> vi; typedef vector<vi> vvi; int main(){ int s,d; int score[][7]={{0,300,500,600,700,1350,1650}, {0,0,350,450,600,1150,1500}, {0,0,0,250,400,1000,1350}, {0,0,0,0,250,850,1300}, {0,0,0,0,0,600,1150}, {0,0,0,0,0,0,500}}; int dist[][7]={{0,6,13,18,23,43,58}, {0,0,7,12,17,37,52}, {0,0,0,5,10,30,45}, {0,0,0,0,5,25,40}, {0,0,0,0,0,20,35}, {0,0,0,0,0,0,15}}; while(scanf("%d",&s),s){ int hs,ms; scanf("%d%d",&hs,&ms); int hd,md; scanf("%d",&d); scanf("%d%d",&hd,&md); s--;d--; if(s>d)swap(s,d); if(1050 <= hs*60+ms && hs*60+ms <= 1170){ if(dist[s][d]<=40){ int ret = score[s][d]; ret /= 2; if(ret%10){ ret+=25; } printf("%d\n",ret); } else{ printf("%d\n",score[s][d]); } } else if(1050 <= hd*60+md && hd*60+md <= 1170){ if(dist[s][d]<=40){ int ret = score[s][d]; ret /= 2; if(ret%10){ ret+=25; } printf("%d\n",ret); } else{ printf("%d\n",score[s][d]); } } else{ printf("%d\n",score[s][d]); } } return 0; }
#include <iostream> #include <sstream> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <complex> using namespace std; #define all(c) (c).begin(),(c).end() #define pb push_back #define mp make_pair #define ERASE(v,i) (v).erase(remove(all(v),i),(v).end()) #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it) #define debug(x) cerr<<#x<<" = "<<(x)<<endl; #define LINE cerr<<"LINE: "<<__LINE__<<endl; inline int toInt(string s){int v;istringstream i(s);i>>v;return v;} template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();} template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;} const int INF = 1000000000; const double PI = acos(-1.0), EPS = 1e-10; int years[] = {9, 19, 29, 39, 49, 59, INF}; const int CNT = 7; inline int stamp(int h, int m) { return 60 * h + m; } inline int wari(int p) { int np = p; np /= 2; if(np % 50 != 0) np = (np - (np % 50)) + 50; return np; } // cost[a][b] (b > a) int cost[7][7] = { {0, 300, 500, 600, 700, 1350, 1650}, {0, 0, 350, 450, 600, 1150, 1500}, {0, 0, 0, 250, 400, 1000, 1350}, {0, 0, 0, 0, 250, 850, 1300}, {0, 0, 0, 0, 0, 600, 1150}, {0, 0, 0, 0, 0, 0, 500}, {0, 0, 0, 0, 0, 0, 0} }; // dist[a][b] (a > b) int dist[7][7] = { {0, 0, 0, 0, 0, 0, 0}, {6, 0, 0, 0, 0, 0, 0}, {13, 7, 0, 0, 0, 0}, {18, 12, 5, 0, 0, 0, 0}, {23, 17, 10, 5, 0, 0, 0}, {43, 37, 30, 25, 20, 0, 0}, {58, 52, 45, 40, 35, 15, 0} }; int main() { #if 0 for(int p; cin >> p;) cout << wari(p) << endl; #endif #if 1 for(;;) { int from, to, from_t, to_t; int h, m; cin >> from; if(from == 0) break; cin >> h >> m; from_t = stamp(h, m); cin >> to; cin >> h >> m; to_t = stamp(h, m); from--, to--; int C = cost[min(from, to)][max(from, to)]; int D = dist[max(from, to)][min(from, to)]; if(D <= 40 && (stamp(17, 30) <= from_t && from_t <= stamp(19, 30)) || (stamp(17, 30) <= to_t && to_t <= stamp(19, 30))) { C = wari(C); } cout << C << endl; } #endif return 0; }
#include<bits/stdc++.h> using namespace std; int main() { int distance[]={6,7,5,5,20,15},money[6][6]={{300,500,600,700,1350,1650},{350,450,600,1150,1500},{250,400,1000,1350},{250,850,1300},{600,1150},{500}}; int start,finish; while(cin>>start,start){ int time[2][2]; for(int i=0;i<2;i++)cin>>time[0][i]; cin>>finish; for(int i=0;i<2;i++)cin>>time[1][i]; int num=0; for(int i=start-1;i<finish-1;i++)num+=distance[i]; bool kawa=0; for(int i=0;i<2&&!kawa&&num<41;i++)if(time[i][0]==18||time[i][0]==17&&time[i][1]>29||time[i][0]==19&&time[i][1]<31)kawa=1; num=money[start-1][finish-start-1]; if(kawa){ num/=2; if(num%50!=0)num+=25; } cout<<num<<endl; } }
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; typedef long long ll; typedef pair<int,int> pii; typedef pair<double,double> pdd; #define _overload4(_1,_2,_3,_4,name,...) name #define _overload3(_1,_2,_3,name,...) name #define _rep1(n) _rep2(i,n) #define _rep2(i,n) _rep3(i,0,n) #define _rep3(i,a,b) for(ll i=a;i<b;++i) #define _rep4(i,a,b,c) for(ll i=a;i<b;i+=c) #define rep(...) _overload4(__VA_ARGS__,_rep4,_rep3,_rep2,_rep1)(__VA_ARGS__) #define _rrep1(n) _rrep2(i,n) #define _rrep2(i,n) _rrep3(i,0,n) #define _rrep3(i,a,b) for(ll i=b-1;i>=a;i--) #define _rrep4(i,a,b,c) for(ll i=a+(b-a-1)/c*c;i>=a;i-=c) #define rrep(...) _overload4(__VA_ARGS__,_rrep4,_rrep3,_rrep2,_rrep1)(__VA_ARGS__) #define each(i,a) for(auto&& i:a) #define sum(...) accumulate(range(__VA_ARGS__),0LL) #define _range(i) (i).begin(),(i).end() #define _range2(i,k) (i).begin(),(i).begin()+k #define _range3(i,a,b) (i).begin()+a,(i).begin()+b #define range(...) _overload3(__VA_ARGS__,_range3,_range2,_range)(__VA_ARGS__) const ll LINF=0x3fffffffffffffff; const ll MOD=1000000007; const ll MODD=0x3b800001; const int INF=0x3fffffff; #define yes(i) out(i?"yes":"no") #define Yes(i) out(i?"Yes":"No") #define YES(i) out(i?"YES":"NO") #define Possible(i)out(i?"Possible":"Impossible") #define unless(a) if(!(a)) //#define START auto start=system_clock::now() //#define END auto end=system_clock::now();cerr<<duration_cast<milliseconds>(end-start).count()<<" ms\n" #define INT(...) int __VA_ARGS__;in(__VA_ARGS__) #define LL(...) ll __VA_ARGS__;in(__VA_ARGS__) #define STR(...) string __VA_ARGS__;in(__VA_ARGS__) #define CHR(...) char __VA_ARGS__;in(__VA_ARGS__) #define DBL(...) double __VA_ARGS__;in(__VA_ARGS__) #define vec(type,name,...) vector<type> name(__VA_ARGS__); #define VEC(type,name,size) vector<type> name(size);in(name) #define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__)) #define pll pair<ll,ll> struct SETTINGS{SETTINGS(){cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}SETTINGS; template<typename T> inline bool update_min(T& mn,const T& cnt){if(mn>cnt){mn=cnt;return 1;}else return 0;} template<typename T> inline bool update_max(T& mx,const T& cnt){if(mx<cnt){mx=cnt;return 1;}else return 0;} template<typename T> inline T max(vector<T>& vec){return *max_element(range(vec));} template<typename T> inline constexpr T gcd (T a,T b) {if(a==b)return a;else return gcd(b,(a-1)%b+1);} inline void in() {} template<typename T> istream& operator >> (istream& is, vector<T>& vec); template<typename T,size_t size> istream& operator >> (istream& is, array<T,size>& vec); template<typename T,typename L> istream& operator >> (istream& is, pair<T,L>& p); template<typename T> ostream& operator << (ostream& os, vector<T>& vec); template<typename T,typename L> ostream& operator << (ostream& os, pair<T,L>& p); template<typename T> istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;} template<typename T,typename L> istream& operator >> (istream& is, pair<T,L>& p){is >> p.first;is >> p.second;return is;} template<typename T> ostream& operator << (ostream& os, vector<T>& vec){os << vec[0];rep(i,1,vec.size()){os << ' ' << vec[i];}return os;} template<typename T> ostream& operator << (ostream& os, deque<T>& vec){os << vec[0];rep(i,1,vec.size()){os << ' ' << vec[i];}return os;} template<typename T,typename L> ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;} template <class Head, class... Tail> inline void in(Head&& head,Tail&&... tail){cin>>head;in(move(tail)...);} template <typename T> inline void out(T t){cout<<t<<endl;} inline void out(){cout<<'\n';} template <class Head, class... Tail> inline void out(Head head,Tail... tail){cout<<head<<' ';out(move(tail)...);} signed main(){ vv(int,a,6,2); in(a); rep(6)sort(range(a[i])); sort(range(a)); if(a[0]!=a[1]||a[2]!=a[3]||a[4]!=a[5])return puts("no")&0; rep(2)rep(j,2)if(a[0][0]==a[2][1^i]&&a[2][0^i]==a[4][1^j]&&a[4][0^j]==a[0][1])return puts("yes")&0; yes(0); }
#include <vector> #include <unordered_map> #include <unordered_set> #include <algorithm> #include <cstdio> using namespace std; template<typename T> class union_find{ unordered_map<T,T> parent; public: T root(T a){ if(parent.find(a)==parent.end())parent[a]=a; return parent[a]==a?a:(parent[a]=root(parent[a])); } int same(T a,T b){return root(a)==root(b);} int unite(T a,T b){ T x=root(a),y=root(b);if(x==y)return 0; parent[x]=y; return 1; } int size(){ unordered_set<T>se; for(auto &e:parent)se.insert(root(e.first)); return se.size(); } }; int main(){ int n,i; vector<pair<int,int> >v(6); union_find<int>uf; unordered_map<int,int>cnt; int f=0; for(i=0;i<6;i++){ scanf("%d%d",&v[i].first,&v[i].second); if(v[i].first>v[i].second)swap(v[i].first,v[i].second); uf.unite(v[i].first,v[i].second); cnt[v[i].first]++; cnt[v[i].second]++; } sort(v.begin(),v.end()); puts(all_of(cnt.begin(),cnt.end(),[](pair<const int,int> &a){return a.second%4==0;}) && uf.size()==1 && v[0]==v[1] && v[2]==v[3] && v[4]==v[5] ? "yes" : "no"); }
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define LINF (ll)INF*INF #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) #define loop(i,a,n) for(int i=a;i<(n);i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) #define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef vector<int> vi; typedef vector<string> vs; typedef pair<int,int> pii; typedef vector<pii> vp; int gcd(int a, int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a, int b){ return a/gcd(a,b)*b; } signed main(void) { vp a(6); rep(i,6){ cin >> a[i].first >> a[i].second; if(a[i].first > a[i].second)swap(a[i].first,a[i].second); } sort(all(a)); if(a[0] != a[1] || a[2] != a[3] || a[4] != a[5]){ cout << "no" << endl; }else{ if(a[0].first == a[2].first && a[0].second == a[4].first && a[2].second == a[4].second) cout << "yes" << endl; else cout << "no" << endl; } }
#include <iostream> #include <iomanip> #include <cmath> #include <algorithm> #include <functional> #include <string> #include <vector> #include <stack> #include <bitset> using namespace std; struct square{ int w; int h; }; int main(){ square face[6]; int i, j, ipow, jpow, T, F, R, Flags = 0; for (i = 0; i < 6; i++){ cin >> face[i].h >> face[i].w; if (face[i].w > face[i].h) swap(face[i].w, face[i].h); } for (i = 0; i < 5; i++){ for (j = i + 1; j < 6; j++){ ipow = pow(2, i); jpow = pow(2, j); if (face[i].w == face[j].w && face[i].h == face[j].h && (Flags & ipow) == 0 && (Flags & jpow) == 0){ Flags += ipow; Flags += jpow; T = i; break; } } if (j < 6) break; } if (i == 4 && j == 5){ cout << "no" << endl; return 0; } for (i = 0; i < 5; i++){ for (j = i + 1; j < 6; j++){ ipow = pow(2, i); jpow = pow(2, j); if (face[i].w == face[j].w && face[i].h == face[j].h && (Flags & ipow) == 0 && (Flags & jpow) == 0){ Flags += ipow; Flags += jpow; F = i; break; } } if (j < 6) break; } if (i == 4 && j == 5){ cout << "no" << endl; return 0; } for (i = 0; i < 6; i++){ ipow = pow(2, i); if ((Flags&ipow) == 0){ Flags += ipow; R = i; break; } } for (i = 0; i < 6; i++){ ipow = pow(2, i); if ((Flags&ipow) == 0){ Flags += ipow; break; } } if (face[R].w != face[i].w || face[R].h != face[i].h){ cout << "no" << endl; return 0; } if (face[T].w == face[F].w && face[T].h == face[R].w && face[F].h == face[R].h){ cout << "yes" << endl; return 0; } if (face[T].w == face[F].w && face[T].h == face[R].h && face[F].h == face[R].w){ cout << "yes" << endl; return 0; } if (face[T].w == face[F].h && face[T].h == face[R].w && face[F].w == face[R].h){ cout << "yes" << endl; return 0; } if (face[T].w == face[F].h && face[T].h == face[R].h && face[F].w == face[R].w){ cout << "yes" << endl; return 0; } if (face[T].h == face[F].w && face[T].w == face[R].w && face[F].h == face[R].h){ cout << "yes" << endl; return 0; } if (face[T].h == face[F].w && face[T].w == face[R].h && face[F].h == face[R].w){ cout << "yes" << endl; return 0; } if (face[T].h == face[F].h && face[T].w == face[R].w && face[F].w == face[R].h){ cout << "yes" << endl; return 0; } if (face[T].h == face[F].h && face[T].w == face[R].h && face[F].w == face[R].w){ cout << "yes" << endl; return 0; } cout << "no" << endl; return 0; }
#include<iostream> #include<algorithm> #include<utility> using namespace std; int main(){ pair<int, int> a[6]; for(int i=0;i<6;i++){ cin>>a[i].first>>a[i].second; if(a[i].first>a[i].second) swap(a[i].first, a[i].second); } sort(a, a+6); pair<int, int> b[3]; int cnt=0; for(int i=0;i<6;i+=2){ if(a[i]==a[i+1]) b[cnt++]=a[i]; else{ cout<<"no"<<endl; return 0; } } if(b[0].first==b[1].first&&b[1].second==b[2].second&&b[2].first==b[0].second) cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include<bits/stdc++.h> using namespace std; #define A first #define B second int main(){ pair<int,int> x[6]; for(int i=0;i<6;++i){ cin>>x[i].A>>x[i].B; if(x[i].A>x[i].B) swap(x[i].A,x[i].B); } sort(x,x+6); pair<int,int> y[3]; for(int i=0;i<6;i+=2){ if(x[i]==x[i+1]) y[i/2]=x[i]; else{ cout<<"no\n"; return 0; } } if(y[0].A==y[1].A && y[1].B==y[2].B && y[2].A==y[0].B) cout<<"yes\n"; else cout<<"no\n"; return 0; }
#include <iostream> #include <map> #include <vector> using namespace std; using pii = pair<int, int>; map<pii, int> mp; bool check(vector<int>& h, vector<int>& w, int a) { if (a == 1) { if (mp[pii(h[0], w[0])] == 4) { swap(h[0], h[1]); swap(w[0], w[1]); } if (h[1] == h[0] && h[1] == w[0]) return true; if (w[1] == h[0] && w[1] == w[0]) return true; } else { map<int, int> mp2; for (int i = 0; i < 3; i++) { if (h[i] == w[i]) return false; mp2[h[i]]++; mp2[w[i]]++; } return (mp2.size() == 3); } return false; } int main() { int h, w; vector<int> nh, nw; map<int, int> mp2; for (int i = 0; i < 6; i++) { cin >> h >> w; mp2[h]++; mp2[w]++; if (h > w) swap(h, w); if (++mp[pii(h, w)] == 1) { nh.emplace_back(h); nw.emplace_back(w); } } int a = 0, b = 0, c = 0; for(auto& it : mp) { if (it.second == 2) a++; if (it.second == 4) b++; if (it.second == 6) c++; } if (a == 3 || (a == 1 && b == 1)){ cout << (check(nh, nw, a) ? "yes" : "no") << endl; } else if (c == 1 && mp2[nh[0]] == 12) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0; }
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define rrep(i,n) for(int i=n-1;i>=0;--i) #define yesno(flg) if(flg){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} #define vi vector<int> #define MAX_N 200005 #define i197 1000000007 using namespace std; typedef long long ll; typedef pair<int,int> Pi; typedef pair<ll,ll> P1; typedef pair<int,P1> P2; const int inf=1000000000; P1 xy[MAX_N]={}; int main() { Pi hw[6]; int h1,w1; rep(i,6){ cin>>h1>>w1; if(h1>w1)swap(h1,w1); hw[i].first=h1; hw[i].second=w1; } sort(hw,hw+6); bool flg=true; if(hw[0]!=hw[1]||hw[2]!=hw[3])flg=false; if(hw[4]!=hw[5]||hw[0].first!=hw[2].first)flg=false; if(hw[0].second!=hw[4].first||hw[2].second!=hw[4].second)flg=false; if(flg){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } return 0; }
#include<iostream> #include<string> #include<algorithm> #include<map> #include<vector> using namespace std; int len[1010] = {},h[6],w[6],maxi=-1,cub[1010]; bool sc[1010],pc[1010]; int main(){ for(int i=0; i<6; i++){ cin >> h[i]; if(maxi < h[i]) maxi = h[i]; cin >> w[i]; if(maxi < w[i]) maxi = w[i]; if(h[i]==w[i])cub[h[i]]++; len[h[i]]++; len[w[i]]++; } for(int i=1; i<=maxi; i++){ bool jud; if(cub[i] == 6)jud=true; else if(cub[i] == 2){ if(len[i]%8 == 0) jud=true; else jud = false; } else if(cub[i] > 0)jud = false; else if(len[i]%4 != 0) jud = false; else jud = true; if(!jud){ cout << "no" << endl; break; } if(i==maxi){ cout << "yes" << endl; } } return 0; }
#include <iostream> #include <algorithm> #include <array> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INT_MAX 2000000000 #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i,a,b) for(i = (a); i < (b); i++) #define bitget(a,b) (((a) >> (b)) & 1) using namespace std; int i, j, k; int main() { int h[6], w[6]; rep(i, 0, 6) cin >> h[i] >> w[i]; int a[6]; int flag = 0; rep(i, 0, 6) a[i] = 10000 * min(h[i], w[i]) + max(h[i], w[i]); sort(a,a+6); if ((a[0] == a[1]) && (a[2] == a[3]) && (a[4] == a[5])) { if ((a[0] / 10000 == a[2] / 10000) && (a[0] % 10000 == a[4] / 10000) && (a[2] % 10000 == a[4] % 10000)) { cout << "yes" << endl; flag = 1; } } if (flag == 0) { cout << "no" << endl; } return 0; }
#include<cstdio> #include<algorithm> using namespace std; typedef long long ll; // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0325 int men[6], d[6]; int main(){ int k=0; for(int i=0;i<6;i++){ int a,b; scanf("%d%d", &a,&b); if(a>b)swap(a,b); // printf("%d,%d\n",a,b); men[i] = a + b * 1001; // printf("%d\n",men[i]); for(int j=0;j<i;j++){ if(men[i]==men[j]){ d[k++]=a; d[k++]=b; men[j]=men[i]=-1; break; } } } if(k==6){ bool c=false; for(int i=0;i<2;i++){ for(int j=0;j<2;j++){ c=c||(d[0]==d[2]&&d[1]==d[4]&&d[3]==d[5]); c=c||(d[0]==d[4]&&d[1]==d[2]&&d[3]==d[5]); // for(int r=0;r<6;r++)printf("%d,",d[r]); // printf("\n"); swap(d[2],d[3]); } swap(d[4],d[5]); } if(c)printf("yes\n"); else printf("no\n"); } else printf("no\n"); }
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> P; int main(){ vector<P> data(6); for(int i=0;i<6;i++){ cin>>data[i].first>>data[i].second; if(data[i].first>data[i].second){ swap(data[i].first, data[i].second); } } sort(data.begin(), data.end()); //for(int i=0;i<6;i++)printf("(%d,%d)\n",data[i].first, data[i].second); if( data[0]!=data[1] || data[2]!=data[3] || data[4]!=data[5]){ cout<<"no"<<endl; return 0; } vector<P> tmp(3); for(int flag=0;flag<8;flag++){ tmp[0]=data[0]; tmp[1]=data[2]; tmp[2]=data[4]; for(int i=0;i<3;i++){ if((flag>>i)&1)swap(tmp[i].first, tmp[i].second); } //(x,y)(y,z)(x,z)になる時があるはず if(tmp[0].first==tmp[2].first && tmp[0].second==tmp[1].first && tmp[1].second==tmp[2].second){ cout<<"yes"<<endl; return 0; } } cout<<"no"<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define F first #define S second typedef pair<int,int> P; int main() { P a[6]; for(int i=0; i<6; i++) { cin >> a[i].F >> a[i].S; if(a[i].F>a[i].S) swap(a[i].F,a[i].S); } sort(a,a+6); for(int i=0; i<3; i++) { if(a[i*2]!=a[i*2+1]) { cout << "no" << endl; return 0; } } if(a[0].F==a[2].F&&a[0].S==a[4].F&&a[2].S==a[4].S) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; } template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef long long ll; typedef pair<int, int> pii; const ll INF = 1e9+100; const ll MOD = 1e9+7; const bool debug = 0; int h[6], w[6]; int main() { map<pii, int> m; REP(i, 6) { scanf("%d %d", h + i, w + i); if (h[i] < w[i]) swap(h[i], w[i]); m[pii(h[i], w[i])]++; } bool ok = true; int c = 0; vector<pii> v; for (map<pii, int>::iterator it = m.begin(); it != m.end(); ++it) { if (it->se & 1) ok = false; REP(i, it->se / 2) v.push_back(it->fi); } if (v.size() != 3) ok = false; if (ok) { ok = false; REP(t1, 2) REP(t2, 2) REP(t3, 2) { pii p1 = v[0]; if (t1) swap(p1.fi, p1.se); pii p2 = v[1]; if (t2) swap(p2.fi, p2.se); pii p3 = v[2]; if (t3) swap(p3.fi, p3.se); if (p1.fi == p2.fi && p3.fi == p1.se && p3.se == p2.se) ok = true; swap(p2, p3); if (p1.fi == p2.fi && p3.fi == p1.se && p3.se == p2.se) ok = true; } } puts(ok ? "yes" : "no"); return 0; }
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 #define INF 1000000010 #define EPS 1e-9 #define fst first #define scd second #define debug(x) cout<<x<<endl; #define repi(i,x,n) for(int i=x;i<n;i++) #define rep(i,n) repi(i,0,n) #define lp(i,n) repi(i,0,n) #define repn(i,n) for(int i=n;i>=0;i--) #define int long long #define endl "\n" signed main(){ cin.tie(0); ios::sync_with_stdio(false); pair<int,int> a[6]; rep(i,6){ cin>>a[i].fst>>a[i].scd; if(a[i].fst<a[i].scd) swap(a[i].fst,a[i].scd); } sort(a,a+6); if(a[0]==a[1] && a[2]==a[3] && a[4]==a[5]){ int x=a[0].fst,y=a[0].scd; int x2[2]={a[2].fst,a[2].scd},y2[2]={a[4].fst,a[4].scd}; rep(i,2){ rep(j,2){ if(x==x2[i] && y==y2[j] && x2[1-i]==y2[1-j]){ cout<<"yes"<<endl; return 0; } if(y==x2[i] && x==y2[j] && x2[1-i]==y2[1-j]){ cout<<"yes"<<endl; return 0; } } } } cout<<"no"<<endl; return 0; }
#include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; bool isCuboid(vector<pair<int, int> > &d) { for (int i = 0; i < 6; i++) { if (d[i].first > d[i].second) { swap(d[i].first, d[i].second); } } sort(d.begin(), d.end()); for (int i = 0; i < 6; i += 2) { if (d[i] != d[i + 1]) return false; } if (d[0].first == d[2].first && d[2].second == d[4].second && d[4].first == d[0].second) { return true; } else { return false; } } int main() { vector<pair<int, int> > hw(6); for (int i = 0; i < 6; i++) { cin >> hw[i].first >> hw[i].second; } if (isCuboid(hw)) { cout << "yes" << endl; } else { cout << "no" << endl; } }
#include <iostream> #include <fstream> #include <stdio.h> #include <cstdlib> #include <string> #include <tuple> #include <vector> #include <map> #include <list> #include <set> #include <queue> #include <stack> #include <algorithm> #include <math.h> #include <random> #include <time.h> #include <cassert> using namespace std; int main(){ pair<int, int> men[6]; for(int i=0; i<6; i++){ int tmp1, tmp2; cin >> tmp1 >> tmp2; if(tmp2 < tmp1) swap(tmp1, tmp2); men[i] = make_pair(tmp1, tmp2); } sort(men, men+6); if(men[0] != men[1] || men[2] != men[3] || men[4] != men[5]){ cout << "no" << endl; return 0; } if(men[0].first == men[2].first){ int tmp1 = men[0].second; int tmp2 = men[2].second; if(tmp2 < tmp1) swap(tmp1, tmp2); if(tmp1 != men[4].first || tmp2 != men[2].second){ cout << "no" << endl; return 0; } } else if(men[0].first == men[4].first){ int tmp1 = men[0].second; int tmp2 = men[4].second; if(tmp2 < tmp1) swap(tmp1, tmp2); if(tmp1 != men[2].first || tmp2 != men[2].second){ cout << "no" << endl; return 0; } } else{ cout << "no" << endl; return 0; } cout << "yes" << endl; return 0; }
#include<iostream> #include<algorithm> #include<vector> using namespace std; pair<int, int>x[6]; vector<int>vec; int main() { for (int i = 0; i < 6; i++) { int a, b; cin >> a >> b; if (a > b)swap(a, b); x[i] = make_pair(a, b); vec.push_back(a); vec.push_back(b); } sort(x, x + 6); for (int i = 0; i < vec.size(); i++) { for (int j = 0; j < vec.size(); j++) { for (int k = 0; k < vec.size(); k++) { if (x[0] != make_pair(vec[i], vec[j]))continue; if (x[1] != make_pair(vec[i], vec[j]))continue; if (x[2] != make_pair(vec[i], vec[k]))continue; if (x[3] != make_pair(vec[i], vec[k]))continue; if (x[4] != make_pair(vec[j], vec[k]))continue; if (x[5] != make_pair(vec[j], vec[k]))continue; cout << "yes" << endl; return 0; } } } cout << "no" << endl; return 0; }
#include "bits/stdc++.h" using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); set<pair<size_t, size_t>> st; map<pair<size_t, size_t>, size_t> cnt; for (size_t i = 0; i < 6; ++i) { size_t h, w; cin >> h >> w; if (h > w) swap(h, w); pair<size_t, size_t> p = make_pair(h, w); st.insert(p); cnt[p]++; } if (st.size() == 3) { vector<size_t> h, w; for (auto &si: st) { if (cnt[si] != 2) { cout << "no" << "\n"; return 0; } h.emplace_back(si.first); w.emplace_back(si.second); } vector<size_t> cnt(1010); for (size_t i = 0; i < 3; ++i) { if (h[i] == w[i]) { cout << "no" << "\n"; return 0; } cnt[h[i]]++, cnt[w[i]]++; } for (size_t i = 0; i < 3; ++i) { if (cnt[h[i]] != 2 || cnt[w[i]] != 2) { cout << "no" << "\n"; return 0; } } cout << "yes" << "\n"; } else if (st.size() == 2) { for (auto &si: st) { if (cnt[si] != 2 && cnt[si] != 4) { cout << "no" << "\n"; return 0; } if (cnt[si] == 2) { if (si.first != si.second) { cout << "no" << "\n"; return 0; } } } cout << "yes" << "\n"; } else if (st.size() == 1) { for (auto &si: st) { if (si.first != si.second) { cout << "no" << "\n"; return 0; } } cout << "yes" << "\n"; } else { cout << "no" << "\n"; } return 0; }
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> P; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); vector<P> a; int temp1, temp2; for(int i = 0;i < 6;++i){ cin >> temp1 >> temp2; if(temp1 > temp2){ a.push_back(P(temp1, temp2)); }else{ a.push_back(P(temp2, temp1)); } } sort(a.begin(), a.end()); if(a[0] == a[1] && a[2] == a[3] && a[4] == a[5]){ bool flag = false; if(a[0].first == a[2].first && a[0].second == a[4].second && a[2].second == a[4].first) flag = true; if(a[0].second == a[2].first && a[0].first == a[4].second && a[2].second == a[4].first) flag = true; if(a[0].first == a[2].second && a[0].second == a[4].second && a[2].first == a[4].first) flag = true; if(a[0].second == a[2].second && a[0].first == a[4].second && a[2].first == a[4].first) flag = true; if(a[0].first == a[2].first && a[0].second == a[4].first && a[2].second == a[4].second) flag = true; if(a[0].second == a[2].first && a[0].first == a[4].first && a[2].second == a[4].second) flag = true; if(a[0].first == a[2].second && a[0].second == a[4].first && a[2].first == a[4].second) flag = true; if(a[0].second == a[2].second && a[0].first == a[4].first && a[2].first == a[4].second) flag = true; if(flag){ cout << "yes" << endl; }else{ cout << "no" << endl; } }else{ cout << "no" << endl; } return 0; }
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> V; typedef pair<ll,ll> P; typedef map<ll,ll> M; #define REP(i,n) for(ll (i) = 0; (i) < (n); ++(i)) int main(){ V h(6); V w(6); map<P,ll> m; REP(i,6){ cin >> h[i] >> w[i]; if(h[i] > w[i])swap(h[i], w[i]); m[make_pair(h[i],w[i])]++; } bool flag = true; for(auto x : m){ if(x.second % 2) flag = false; } if(!flag){ cout << "no" << endl; return 0; } vector<P> p; for(auto x : m){ REP(i, x.second / 2) p.push_back(x.first); } sort(p.begin(), p.end()); flag = ( p[0].first == p[1].first && min(p[0].second, p[1].second) == p[2].first && max(p[0].second, p[1].second) == p[2].second ); cout << (flag ? "yes" : "no" ) << endl; }
#include <bits/stdc++.h> using namespace std; int main(){ int c,q,i,j,z=0,k=1,m[1001][1001]={0},e[6][2]={0}; for(i=0;i<6;i++){ cin>>q>>c; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++)for(j=0;j<1001;j++){ if(m[i][j]){ if(m[i][j]==4){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else if(m[i][j]==6){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else{ e[z][0]=i;e[z++][1]=j;} } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; }
#include <stdio.h> #include <vector> using namespace std; #define PB push_back struct b{ int h; int w; bool operator ==(const b &a){return (h==a.h&&w==a.w)||(h==a.w&&w==a.h);} void in(){ scanf("%d%d",&h,&w); return ; } void reset(){ h=w=0; return ; } bool check(){return h!=0&&w!=0;} void operator =(const b &a){ h=a.h; w=a.w; return ; } }; void swap(b &a,b &r){ b temp=a; a=r; r=temp; return ; } int main(){ vector<b> v; b a[6]; bool f; for(int i=0;i<6;i++)a[i].in(); for(int i=0;i<6;i++)if(a[i].check()){ f=false; for(int j=i+1;j<6;j++)if(a[j]==a[i]){ f=true; v.PB(a[i]); a[i].reset(); a[j].reset(); break; } if(!f){ printf("no\n"); return 0; } } for(int i=0;i<2;i++){ if(v[0].h==v[1].h&&v[1].w==v[2].h&&v[2].w==v[0].w){ printf("yes\n"); return 0; } else if(v[0].h==v[1].h&&v[1].w==v[2].w&&v[2].h==v[0].w){ printf("yes\n"); return 0; } else if(v[0].h==v[1].w&&v[1].h==v[2].h&&v[2].w==v[0].w){ printf("yes\n"); return 0; } else if(v[0].h==v[1].w&&v[1].h==v[2].w&&v[2].h==v[0].w){ printf("yes\n"); return 0; } swap(v[1],v[2]); } printf("no\n"); }
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <tuple> # include <functional> # include <utility> # define INF 1000000000 # define MOD 1000000000+7 using namespace std; int main() { pair< int, int > Q[6]; for (int i = 0; i < 6; i++) { cin >> Q[i].first >> Q[i].second; if (Q[i].first > Q[i].second) swap(Q[i].first, Q[i].second); } sort(Q, Q + 6); if (Q[0] == Q[1] && Q[2] == Q[3] && Q[4] == Q[5] && Q[0].first == Q[2].first&&Q[2].second == Q[4].second && Q[0].second == Q[4].first) { cout << "yes" << endl; } else { cout << "no" << endl; } }
#include<cstdio> #include<algorithm> using namespace std; typedef pair<int,int> P; void func(int); int main(void) { int i,j,x,y,flg; P pp[6]; for(i=0;i<6;i++) { scanf("%d %d",&x,&y); if(x>y) swap(x,y); pp[i].first=x; pp[i].second=y; } sort(pp,pp+6); flg=1; if(pp[0].first!=pp[1].first || pp[0].second!=pp[1].second) flg=0; if(pp[2].first!=pp[3].first || pp[2].second!=pp[3].second) flg=0; if(pp[4].first!=pp[5].first || pp[4].second!=pp[5].second) flg=0; if(pp[0].first!=pp[2].first || pp[0].second!=pp[4].first || pp[2].second!=pp[4].second) flg=0; if(flg==1) printf("yes\n"); else printf("no\n"); return 0; }
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<map> #include<set> #include<stack> #include<queue> #include<math.h> using namespace std; typedef long long ll; #define int long long typedef vector<int> VI; typedef pair<int, int> pii; #define fore(i,a) for(auto &i:a) #define REP(i,n) for(int i=0;i<n;i++) #define eREP(i,n) for(int i=0;i<=n;i++) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define eFOR(i,a,b) for(int i=(a);i<=(b);++i) #define SORT(c) sort((c).begin(),(c).end()) #define rSORT(c) sort((c).rbegin(),(c).rend()) #define LB(x,a) lower_bound((x).begin(),(x).end(),(a)) #define UB(x,a) upper_bound((x).begin(),(x).end(),(a)) #define INF 1000000000 #define LLINF 9223372036854775807 #define mod 1000000007 //vector<vector<int> > dp; //vector<vector<vector<int> > > vvvi; //dp=vector<vector<int> >(N, vector<int>(M,0)); //vector<pair<int,int> > v; //v.push_back(make_pair(x,y)); //priority_queue<int,vector<int>, greater<int> > q2; signed main(){ cin.tie(0); ios::sync_with_stdio(false); vector<pii> A; int a, b, c, d, e, f; REP(i, 6) { int s, t; cin >> s >> t; A.push_back(pii(min(s, t), max(s, t))); } SORT(A); for (int i = 0; i < 6; i += 2) { if (A[i].first != A[i + 1].first || A[i].second != A[i + 1].second) { cout << "no" << endl; return 0; } else { if (i == 0) { a = A[i].first; b = A[i].second; } else if (i == 2) { c = A[i].first; d = A[i].second; } else { e = A[i].first; f = A[i].second; } } } bool ans = false; if (a == c) { if (b == f && d == e)ans = 1; else if (b == e && d == f)ans = 1; } else if (a == d) { if (b == f && c == e)ans = 1; else if (b == e && c == f)ans = 1; } else if (a == e) { if (b == c && d == f)ans = 1; else if (b == d && c == f)ans = 1; } else if (a == f) { if (b == c && d == e)ans = 1; else if (b == d && c == e)ans = 1; } // cout << a << " " << b << " " << c << " " << d << " " << e << " "<<f << endl; cout << (ans ? "yes" : "no") << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int h[7],w[7]; int hantei1=0,hantei2=0,hantei3=0; int cnt1=0,cnt2=0,cnt3=0; int test1=0,test2=0,test3=0; bool flg = true; int sqrcnt=0; long long temp=0; for (int i=1 ; i<=6 ;i++) { cin >> h[i] >> w[i]; if (h[i] == w[i]) sqrcnt++; if ((test1 != h[i] && test2 != h[i] && test3 != h[i]) && (test1 != 0 && test2 != 0 && test3 != 0) ) { flg =false; } else { if (test1 == 0) { test1 = h[i]; } else if (test2 == 0 && test1 != h[i]) { test2 = h[i]; } else if (test3 == 0 && test1 != h[i] && test2 != h[i]) { test3 = h[i]; } } if ((test1 != w[i] && test2 != w[i] && test3 != w[i]) && (test1 != 0 && test2 != 0 && test3 != 0) ) { flg =false; } else { if (test1 == 0) { test1 = w[i]; } else if (test2 == 0 && test1 != w[i]) { test2 = w[i]; } else if (test3 == 0 && test1 != w[i] && test2 != w[i]) { test3 = w[i]; } } temp = pow(h[i],2) + pow(w[i], 2); if (hantei1 == temp) cnt1++; else if (hantei2 == temp) cnt2++; else if (hantei3 == temp) cnt3++; else { if (hantei1 == 0) { hantei1 = temp; cnt1++; } else if (hantei2 == 0) { hantei2 = temp; cnt2++; } else if (hantei3 == 0) { hantei3 = temp; cnt3++; } } } if (sqrcnt >= 2 && test3 != 0) { flg = false; } else if (test3 == 0 && sqrcnt < 2) { flg = false; } else if (sqrcnt >= 4 && test3 != 0 && test2 != 0) { flg = false; } if ((cnt1 % 2 ==0 && cnt2 % 2 ==0 && cnt3 % 2 ==0) && flg) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0; }
#include <iostream> #include <algorithm> #define f first #define s second using namespace std; int main(){ pair <int,int> a[6]; for(int i=0,c,b;i<6&&cin>>c>>b;a[i++]=make_pair(c,b)) if(c>b) swap(c,b); sort(a,a+6); int r=0; for(int i=0;i<3;i++) if(a[i*2]!=a[i*2+1]) r++; if(!r&&a[0].f==a[2].f&&a[2].s==a[4].s&&a[0].s==a[4].f) cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; class Area { public: Area() {} Area(int _h, int _w) { h = _h; w = _w; } bool operator<(const Area& area) const { if (h == area.h) { return w < area.w; } return h < area.h; } bool area_equal(Area area) { return h == area.h && w == area.w; } int h, w; }; bool check(Area a1, Area a2, Area a3) { if (a1.h == a2.h && a2.w == a3.h && a3.w == a1.w) { return true; } if (a1.w == a2.h && a2.w == a3.h && a3.w == a1.h) { return true; } if (a1.h == a2.w && a2.h == a3.h && a3.w == a1.w) { return true; } if (a1.w == a2.w && a2.h == a3.h && a3.w == a1.h) { return true; } if (a1.h == a2.h && a2.w == a3.w && a3.h == a1.w) { return true; } if (a1.w == a2.h && a2.w == a3.w && a3.h == a1.h) { return true; } if (a1.h == a2.w && a2.h == a3.w && a3.h == a1.w) { return true; } if (a1.w == a2.w && a2.h == a3.w && a3.h == a1.h) { return true; } return false; } string solve(vector<Area> vec) { bool flag = vec[0].area_equal(vec[1]) & vec[2].area_equal(vec[3]) & vec[4].area_equal(vec[5]); if (!flag) { return "no"; } if (check(vec[0], vec[2], vec[4])){ return "yes"; } return "no"; } int main() { int h, w; vector<Area> vec; for (int i = 0; i < 6; ++i) { cin >> h >> w; if (h > w) { swap(h, w); } vec.push_back(Area(h, w)); } sort(vec.begin(), vec.end()); cout << solve(vec) << endl; return 0; }
#include<bits/stdc++.h> using namespace std; int main(){ bool j=true; int count=0; vector<pair<int,int>> s; for(int i=0;i<6;i++){ int h,w; cin>>h>>w; if(h>w){swap(h,w);} s.push_back({h,w}); } sort(s.begin(),s.end()); vector<pair<int,int>> e; for(int i=0;i<3;i++){ if(s[i*2]!=s[i*2+1]){j=false; break;} bool samef=false; bool sames=false; for(int t=0;t<3;t++){ if(t!=i && (s[i*2].first==s[t*2].second || s[i*2].first==s[t*2].first)){samef=true;} if(t!=i && (s[i*2].second==s[t*2].second || s[i*2].second==s[t*2].first)){sames=true;} } if(!samef || !sames){j=false; break;} bool donef=false; bool dones=false; for(int t=0;t<e.size();t++){ if(e[t].first==s[i*2].first){e[t].second++; donef=true;} } if(!donef){e.push_back({s[i*2].first,1});} for(int t=0;t<e.size();t++){ if(e[t].first==s[i*2].second){e[t].second++; dones=true;} } if(!dones){e.push_back({s[i*2].second,1});} } for(int i=0;i<e.size();i++){ if(e[i].second%2!=0){j=false;} } cout<<(j?"yes":"no")<<endl; return 0; }
#include <bits/stdc++.h> #define REP(i ,n) for(int i=0 ;i < n; i++) #define REPB(i ,n) for(int i=n; i >= 0; i--) #define FOR(i ,m ,n) for(int i=m; i < n; i++) #define FORB(i, m, n) for(int i=m; i>= m; i--) #define ll long long #define pb push_back #define popb pop_back #define debug(i) cout << i << endl using namespace std; int main(){ int h,w; vector<pair<int,int>> bx; REP(i,6){ cin >> h >> w; if(h < w) bx.pb(make_pair(h,w)); else bx.pb(make_pair(w,h)); } sort(bx.begin(),bx.end()); REP(i,3){ if(bx[2*i + 1].first != bx[2* i].first || bx[2* i + 1].second != bx[2*i].second){ cout << "no" << endl; return 0; } } if(bx[0].first == bx[2].first){ if(bx[0].second < bx[2].second){ if(bx[4].first != bx[0].second || bx[4].second != bx[2].second){ cout << "no" << endl; return 0; } }else{ if(bx[4].second != bx[0].second || bx[4].first != bx[2].second){ cout << "no" << endl; return 0; } } }else if(bx[0].first == bx[2].second){ if(bx[0].second < bx[2].second){ if(bx[4].first != bx[0].second || bx[4].second != bx[2].first){ cout << "no" << endl; return 0; } }else{ if(bx[4].second != bx[0].second || bx[4].first != bx[2].first){ cout << "no" << endl; return 0; } } }else{ cout << "no" << endl; return 0; } cout << "yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > SideInfos; bool cmp(const pair<int, int> &s1, const pair<int, int> &s2) { if (s1.first == s2.first) { return s1.second < s2.second; } return s1.first < s2.first; } int main() { int h, w; SideInfos.clear(); for (int i = 0; i < 6; ++i) { cin >> h >> w; if (h > w) { swap(h, w); } SideInfos.push_back(make_pair(h, w)); } sort(SideInfos.begin(), SideInfos.end(), cmp); for (int i = 0; i < 3; ++i) { if (SideInfos[i].first != SideInfos[i+1].first) { cout << "no" << endl; return 0; } } for (int i = 2; i < 5; ++i) { if (SideInfos[i].second != SideInfos[i + 1].second) { cout << "no" << endl; return 0; } } if (SideInfos[0].second != SideInfos[1].second || SideInfos[4].first != SideInfos[5].first) { cout << "no" << endl; return 0; } if (SideInfos[1].second != SideInfos[4].first) { cout << "no" << endl; return 0; } cout << "yes" << endl; return 0; }
#include<iostream> #include<algorithm> #define X first #define Y second using namespace std; pair<int,int> z[6]; int main(){ int a,b,t; for(int i=0;i<6;i++){ cin>>a>>b; if(a>b)t=a,a=b,b=t; z[i].X=a,z[i].Y=b; } sort(z,z+6); bool ok=true; if(z[0]!=z[1]||z[2]!=z[3]||z[4]!=z[5])ok=false; if(z[0].X!=z[2].X||z[0].Y!=z[4].X||z[2].Y!=z[4].Y)ok=false; if(ok)cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include <iostream> #include <algorithm> #include <utility> using namespace std; int main() { pair<int, int> p[6]; for (int i = 0; i < 6; ++i) { cin >> p[i].first >> p[i].second; if (p[i].first > p[i].second) swap(p[i].first, p[i].second); } sort(p, p + 6); if (!(p[0].first == p[1].first && p[0].second == p[1].second)) { cout << "no" << endl; return 0; } if (!(p[2].first == p[3].first && p[2].second == p[3].second)) { cout << "no" << endl; return 0; } if (!(p[4].first == p[5].first && p[4].second == p[5].second)) { cout << "no" << endl; return 0; } int a = p[0].first, b = p[0].second, c; if (a == p[2].first) c = p[2].second; else if (a == p[2].second) c = p[2].first; else { cout << "no" << endl; return 0; } if (!((p[4].first == b && p[4].second == c) || (p[4].first == c && p[4].second == b))) cout << "no" << endl; else cout << "yes" << endl; return 0; }
#include <stdio.h> #include <utility> #include <algorithm> #define rep(i, n) for(int i = 0; i < n; ++i) using namespace std; int main(void) { int i, j, k; pair<int, int> p[6]; rep(i, 6) { scanf("%d%d", &p[i].first, &p[i].second); int t; if(p[i].first > p[i].second) t = p[i].first, p[i].first = p[i].second, p[i].second = t; } sort(p, p + 6); rep(i, 3) { if(p[i * 2].first != p[i * 2 + 1].first || p[i * 2].second != p[i * 2 + 1].second) { printf("no\n"); return 0; } } if((p[0].first == p[2].first && p[0].second == p[4].first && p[2].second == p[4].second) || (p[0].first == p[2].second && p[0].second == p[4].first && p[2].first == p[4].second) || (p[0].first == p[2].second && p[0].second == p[4].second && p[2].first == p[4].first) || (p[0].first == p[4].second && p[0].second == p[2].first && p[2].second == p[4].first) || (p[0].first == p[4].second && p[0].second == p[2].second && p[2].first == p[4].first)) printf("yes\n"); else printf("no\n"); return 0; }
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; int main() { vector<pair<int, int> > v(6); for(int i=0; i<6; ++i) cin >> v[i].first >> v[i].second; sort(v.begin(), v.end()); do{ for(int i=0; i<(1<<6); ++i){ bitset<32> bs(i); vector<pair<int, int> > w = v; for(int j=0; j<6; ++j){ if(bs[j]) swap(w[j].first, w[j].second); } if( w[0].first == w[1].first && w[1].first == w[2].first && w[2].first == w[3].first && w[4].first == w[5].first && w[5].first == w[0].second && w[0].second == w[1].second && w[2].second == w[3].second && w[3].second == w[4].second && w[4].second == w[5].second ) { cout << "yes" << endl; return 0; } } }while(next_permutation(v.begin(), v.end())); cout << "no" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ vector<pair<int, int>> ydk; for(int i = 0;i < 6;i++){ int h, w; cin >> h >> w; if(h > w) swap(h, w); ydk.push_back({h, w}); } sort(ydk.begin(), ydk.end()); for(int i = 0;i < 3;i++){ if(ydk[i*2] != ydk[i*2+1]){ cout << "no" << endl; return 0; } } pair<int, int> a, b, c; a = ydk[0], b = ydk[2], c = ydk[4]; string OK = "no"; if(a.first == b.first){ if(b.second == c.first && c.second == a.second){ OK = "yes"; }else if(b.second == c.second && c.first == a.second){ OK = "yes"; } } if(a.first == b.second){ if(b.first == c.first && c.second == a.second){ OK = "yes"; }else if(b.first == c.second && c.first == a.second){ OK = "yes"; } } if(a.second == b.first){ if(b.second == c.first && c.second == a.first){ OK = "yes"; }else if(b.second == c.second && c.first == a.first){ OK = "yes"; } } if(a.second == b.second){ if(b.first == c.first && c.second == a.first){ OK = "yes"; }else if(b.first == c.second && c.first == a.first){ OK = "yes"; } } cout << OK << endl; return 0; }
#include<iostream> #include<vector> #include<algorithm> using namespace std; int b[6][2] = { {0,1}, {0,1}, {0,2}, {0,2}, {1,2}, {1,2} }; int main(){ vector<pair<int,int>> v; int x, y; for(int i = 0; i < 6; i++){ cin >> x >> y; if(x > y) swap(x, y); v.push_back({x, y}); } sort(v.begin(), v.end()); bool judge = false; //do{ int a[3] = {v[0].first, v[0].second, v[2].second}; bool inner = true; for(int i = 0; i < 6; i++){ inner &= v[i].first == a[b[i][0]]; inner &= v[i].second == a[b[i][1]]; } if(inner) judge = true; //}while(next_permutation(v.begin(), v.end())); if(judge) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ pair< int, int > Q[6]; for(int i = 0; i < 6; i++) { cin >> Q[i].first >> Q[i].second; if(Q[i].first > Q[i].second) swap(Q[i].first, Q[i].second); }sort(Q, Q + 6); if(Q[0] == Q[1] && Q[2] == Q[3] && Q[4] == Q[5] && Q[0].first == Q[2].first && Q[2].second == Q[4].second && Q[0].second == Q[4].first) { cout << "yes" << endl; } else cout << "no" << endl; }
#include<iostream> #include<vector> #include<algorithm> using namespace std; int b[6][2] = { {0,1}, {0,1}, {0,2}, {0,2}, {1,2}, {1,2} }; int main(){ vector<pair<int,int>> v; int x, y; for(int i = 0; i < 6; i++){ cin >> x >> y; if(x > y) swap(x, y); v.push_back({x, y}); } sort(v.begin(), v.end()); bool judge = true; int a[3] = {v[0].first, v[0].second, v[2].second}; for(int i = 0; i < 6; i++){ judge &= v[i].first == a[b[i][0]]; judge &= v[i].second == a[b[i][1]]; } if(judge) cout << "yes" << endl; else cout << "no" << endl; return 0; }
//↓template↓ #include "bits/stdc++.h" using namespace std; #define Would #define you #define all(n) n.begin(),n.end() const long long INF = 1e18; const long long MOD = 1e9 + 7; const double pi = acos(-1); const int SIZE = 1 << 17; int dx[] = { 1,0 }, dy[] = { 0,1 }, alp[30]; long long fac[200005], finv[200005], inv[200005]; vector<long long>dij; struct edge { long long to, cost; }; vector<vector<edge> >G; long long mod_pow(long long a, long long b) { long long res = 1; while (b) { if (b & 1) { res = res * a%MOD; } a = a * a%MOD; b >>= 1; } return res; } void addedge(int from, int to, int cost) { G[from].push_back({ to,cost }); G[to].push_back({ from,cost }); } //↑template↑ string ans = "no"; int main() { vector<pair<int, int> >v; for (int i = 0; i < 6; ++i) { int a, b; cin >> a >> b; if (a > b) { swap(a, b); } v.push_back(make_pair(a, b)); } sort(all(v)); if (v[0] == v[1] && v[2] == v[3] && v[4] == v[5] && v[0].first == v[2].first&&v[2].second == v[4].second&&v[0].second == v[4].first) { ans = "yes"; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define rep(i, a, n) for(int i = (a); i < (n); i++) #define dep(i, a, n) for(int i = (a); i >= (n); i--) #define mod 1e9+7 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } int main() { map<P, int> mp; rep(i, 0, 6) { int h, w; cin >> h >> w; mp[P(min(h, w), max(h, w))]++; } vector<P> v; for(auto x : mp) { if(x.second % 2 == 1) { cout << "no" << endl; return 0; } rep(i, 0, x.second / 2) v.pb(x.first); } int f = 0; if(v[0].first == v[1].first) { if(v[0].second == v[2].first && v[1].second == v[2].second) f = 1; if(v[0].second == v[2].second && v[1].second == v[2].first) f = 1; } if(v[0].first == v[1].second) { if(v[0].second == v[2].first && v[1].first == v[2].second) f = 1; if(v[0].second == v[2].second && v[1].first == v[2].first) f = 1; } if(v[0].second == v[1].first) { if(v[0].first == v[2].first && v[1].second == v[2].second) f = 1; if(v[0].first == v[2].second && v[1].second == v[2].first) f = 1; } if(v[0].second == v[1].second) { if(v[0].first == v[2].first && v[1].first == v[2].second) f = 1; if(v[0].first == v[2].second && v[1].first == v[2].first) f = 1; } if(f) cout << "yes" << endl; else cout << "no" << endl; }
#include <bits/stdc++.h> using namespace std; #define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20); #define int long long #define gcd __gcd #define all(x) (x).begin(), (x).end() template<class T> bool chmax(T& a, T b){return (a = max(a, b)) == b;} template<class T> bool chmin(T& a, T b){return (a = min(a, b)) == b;} #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++) #define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__) #define _rev(i, n) revi(i, n, 0) #define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--) #define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__) #define each(i, n) for(auto&& i: n) const int INF = 1e18, MOD = 1e9 + 7; signed main() { INCANT; int h, w; pair<int, int> v[6]; rep(i, 6){ cin>>h>>w; if(h>w){ swap(h, w); } v[i] = {h, w}; } sort(v, v + 6); if(v[0] != v[1] || v[2] != v[3] || v[4] != v[5]){ cout<<"no"<<endl; }else{ if(v[0].first == v[2].first && v[2].second == v[4].second && v[4].first == v[0].second){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } } }
#include <bits/stdc++.h> using namespace std; int main(){ int c,q,i,j,z=0,k=1,o=0,m[1001][1001]={0}; int a[1001]={0},b[1001]={0},w[1001]={0},e[6][2]={0}; for(i=0;i<6;i++){ cin>>q>>c; w[q]++; w[c]++; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++){ if(w[i])o++; for(j=0;j<1001;j++){ if(m[i][j]){a[j]+=m[i][j];b[i]+=m[i][j]; if(m[i][j]==4){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else if(m[i][j]==6){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else{ e[z][0]=i;e[z++][1]=j;} } } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; typedef pair<int,int> P; int main() { cin.tie(0); ios::sync_with_stdio(false); P p[6]; int h,w; for (int i = 0;i < 6;i++){ cin >> h >> w; p[i] = P(min(h,w),max(h,w)); } sort(p,p+6); if(p[0] == p[1] && p[2] == p[3] && p[4] == p[5] && p[0].first == p[2].first && p[3].second == p[4].second && p[5].first == p[0].second){ cout << "yes" << endl; }else{ cout << "no" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define UNIQUE(v) v.erase(unique(all(v)), v.end()); #define ZIP(v) sort(all(v)),UNIQUE(v) #define ADD(a, b) a = (a + b) % mod #define SUB(a, b) a = (a+mod-b)%mod #define MUL(a, b) a = (a * b) % mod #define repi(i,m,n) for(int i = m;i < n;i++) #define drep(i,n,m) for(int i = n;i >= m;i--) #define rep(i,n) repi(i,0,n) #define rrep(i,n) repi(i,1,n+1) #define chmin(x,y) x = min(x,y) #define chmax(x,y) x = max(x,y) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(), v.rend() #define dmp(x,y) make_pair(x,y) #define pb(x) push_back(x) #define fi first #define se second typedef pair<int,int> P; typedef pair<int, P> PP; typedef pair<P, int> Pi; typedef vector<int> vi; typedef deque<int> dq; const int inf = 1e9+7; const int INF = 1e18+7; vector<P> vs; int solve(int a, int b, int c){ if(a == b or b == c or a == c)return 0; vector<P> v; v.pb(vs[a]);v.pb(vs[b]);v.pb(vs[c]); int ans = 0; rep(i,2){ rep(j,2){ rep(k,2){ if(v[0].fi == v[1].fi and v[0].se == v[2].fi and v[1].se == v[2].se)ans = 1; swap(v[2].fi, v[2].se); } swap(v[1].fi, v[1].se); } swap(v[0].fi, v[0].se); } return ans; } signed main(){ rep(i,6){ int x, y; scanf("%lld%lld", &x, &y); if(x > y)swap(x, y); vs.push_back(P(x, y)); } int ans = 1, res = 0; sort(all(vs)); rep(i,6)if(i%2 == 0)if(vs[i] != vs[i+1])ans = 0; rep(i,3)vs.erase(vs.begin()+i+1); rep(i,3)rep(j,3)rep(k,3)res += solve(i, j, k); if(ans and res)printf("yes\n"); else printf("no\n"); //printf("%lld\n", ans); //rep(i,vs.size())printf("%lld %lld\n", vs[i].fi, vs[i].se); return 0; }
#include<cstdio> #include <iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<set> #include<numeric> using namespace std; typedef long long ll; typedef pair<int, int>P; int main(void) { P D[6]; for (int i = 0; i < 6; i++) { cin >> D[i].first >> D[i].second; if (D[i].first > D[i].second)swap(D[i].first, D[i].second); } int flag = 0; sort(D,D+6); for (int i = 0; i < 6; i += 2) { if (D[i] == D[i + 1])D[i / 2] = D[i]; else { flag = 1; cout << "no" << endl; break; } } if (!flag) { if (D[0].first == D[1].first && D[0].second == D[2].first && D[1].second == D[2].second) cout << "yes" << endl; else cout << "no" << endl; } return 0; }
#include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { vector<pair<int, int> > v(6); for (int i = 0; i < 6; i++) { cin >> v[i].first >> v[i].second; if (v[i].first > v[i].second) swap(v[i].first, v[i].second); } sort(v.begin(), v.end()); if (v[0] != v[1] || v[2] != v[3] || v[4] != v[5]) cout << "no" << endl; else if (v[0].first != v[2].first || v[0].second != v[4].first || v[2].second != v[4].second) cout << "no" << endl; else cout << "yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ int c,q,i,j,z=0,k=1,m[1001][1001]={0},e[6][2]={0}; for(i=0;i<6;i++){ cin>>q>>c; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++)for(j=0;j<1001;j++){ if(m[i][j]){ if(m[i][j]==6||m[i][j]==4)for(c=0;c<m[i][j]/2;c++){e[z][0]=i;e[z++][1]=j;} else {e[z][0]=i;e[z++][1]=j;} } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; }
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt" bool check(vector<pair<int, int>>v) { return v[0].first == v[1].first&&v[0].second == v[2].first&& v[1].second == v[2].second; } int main() { map<pair<int, int>, int>mp; for (int i = 0; i < 6; ++i) { int a, b; cin >> a >> b; if (a > b)swap(a, b); mp[make_pair(a, b)]++; } bool ok = true; for (auto m : mp) { if (m.second %2)ok = false; } if (ok) { pair<int, int>p; pair<int, int>q; pair<int, int>r; if (mp.size() == 3) { p = (mp.begin()->first); q = (next(mp.begin())->first); r = (next(next(mp.begin()))->first); } else if (mp.size() == 2) { p = (mp.begin()->first); q = (next(mp.begin())->first); if (mp.begin()->second == 2)r = q; else r = p; } else { p = q = r = (mp.begin()->first); } vector<pair<int, int>>av{ p,q,r }; sort(av.begin(), av.end()); if (!(check(av)))ok = false; } if (ok)cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include<bits/stdc++.h> using namespace std; #define fst first #define sec second int main(){ pair<int,int> x[6]; for(int i=0;i<6;++i){ cin>>x[i].fst>>x[i].sec; if(x[i].fst>x[i].sec) swap(x[i].fst,x[i].sec); } sort(x,x+6); pair<int,int> y[3]; for(int i=0;i<6;i+=2){ if(x[i]==x[i+1]) y[i/2]=x[i]; else{ cout<<"no\n"; return 0; } } if(y[0].fst==y[1].fst && y[1].sec==y[2].sec && y[2].fst==y[0].sec) cout<<"yes\n"; else cout<<"no\n"; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second using pi = pair<int,int>; string solve() { map<pi,int> ct; vector<int> l; rep(i,6) { int h,w; cin >>h >>w; if(h>w) swap(h,w); l.pb(h); l.pb(w); ++ct[pi(h,w)]; } sort(all(l)); l.erase(unique(all(l)),l.end()); int L = l.size(); rep(k,L)rep(j,k+1)rep(i,j+1) { int a=l[i], b=l[j], c=l[k]; pi x[3]; x[0] = pi(a,b); x[1] = pi(a,c); x[2] = pi(b,c); map<pi,int> rem=ct; bool ok = true; rep(xx,3) { if(rem[x[xx]]>=2) rem[x[xx]]-=2; else ok=false; } if(ok) return "yes"; } return "no"; } int main() { cout << solve() << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ int c,q,i,j,z=0,k=1,o=0,m[1001][1001]={0},e[6][2]={0}; for(i=0;i<6;i++){ cin>>q>>c; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++){ for(j=0;j<1001;j++){ if(m[i][j]){ if(m[i][j]==4){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else if(m[i][j]==6){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else{ e[z][0]=i;e[z++][1]=j;} } } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; }
#include <stdio.h> int main(){ int h[6],w[6],i,j,blank,a=0; for(i = 0; i < 6; i++){ scanf("%d %d",&h[i],&w[i]); if(h[i] > w[i]){ blank=h[i]; h[i]=w[i]; w[i]=blank; } } for(i = 0; i < 5; i++){ for(j = 0; j < 5; j++){ if(h[j] > h[j+1]){ blank=h[j]; h[j]=h[j+1]; h[j+1]=blank; blank=w[j]; w[j]=w[j+1]; w[j+1]=blank; } if(h[j] == h[j+1] && w[j] > w[j+1]){ blank=w[j]; w[j]=w[j+1]; w[j+1]=blank; } } } //for(i = 0; i < 6; i++) printf("%d %d\n",h[i],w[i]); for(i = 0; i < 6; i += 2){ if(h[i] != h[i+1]) a++; if(w[i] != w[i+1]) a++; } if(a != 0){ printf("no\n"); return 0; } if(h[0] == h[2] && w[0] == h[4] && w[2] == w[4]) printf("yes\n"); else printf("no\n"); return 0; }
#include <bits/stdc++.h> using namespace std; struct rect{ int h,w; }; bool operator<(rect r1, rect r2){ if(r1.w == r2.w){ return r1.h > r2.h; } return r1.w > r2.w; } int main() { rect r[6]; for(int i=0;i<6;i++) { cin >> r[i].h >> r[i].w; if (r[i].h > r[i].w) { swap(r[i].h, r[i].w); } } sort(r,r+6); /*if(r[0].w != r[2].w && r[2].w == r[5].w){ swap(r[0],r[4]); swap(r[1],r[5]); }*/ /*for(int i=0;i<6;i++) { cout << r[i].w << " " << r[i].h << endl; }*/ if(r[0].h == r[1].h && r[0].w == r[1].w && r[2].h == r[3].h && r[2].w == r[3].w && r[4].h == r[5].h && r[4].w == r[5].w && r[0].w == r[2].w && r[2].h == r[4].h && r[0].h == r[4].w){ cout << "yes" << endl; } else{ cout << "no" << endl; } // x1=x2,y1=y3,y2=x3; return 0; }
#include<bits/stdc++.h> using namespace std; #define int long long typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) #define all(v) (v).begin(),(v).end() #define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++) #define pb push_back #define fi first #define se second template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} signed main(){ pair<int,int>v[6]; rep(i,6){ cin>>v[i].fi>>v[i].se; if(v[i].fi>v[i].se)swap(v[i].fi,v[i].se); } sort(v,v+6); if(v[0]==v[1]&&v[2]==v[3]&&v[4]==v[5]&&v[0].fi==v[2].fi&&v[0].se==v[4].fi&&v[2].se==v[4].se)cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) int main() { pair<ll, ll> A[6]; rep(i, 6) { cin >> A[i].first >> A[i].second; if (A[i].first > A[i].second) { swap(A[i].first, A[i].second); } } sort(A, A + 6); rep(i, 6) if (i & 1) { if (A[i].first != A[i - 1].first || A[i].second != A[i - 1].second) { return puts("no") & 0; } } vector<pair<ll, ll>> B = {A[0], A[2], A[4]}; bool flag = 0; flag = B[0].first==B[1].first&&B[0].second==B[2].first&&B[1].second==B[2].second; cout << (flag ? "yes" : "no") << endl; }
#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <cstring> #include <vector> #include <queue> #include <set> #include <map> #include <cmath> #include <iomanip> #include <cassert> #include <bitset> using namespace std; typedef pair<int, int> P; #define rep(i, n) for (int i=0; i<(n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin()) #define _1 first #define _2 second #define pb push_back #define INF 1145141919 #define MOD 1000000007 P mp(int x, int y) { if (x > y) swap(x, y); return P(x, y); } map<P, int> ctr; signed main() { ios::sync_with_stdio(false); cin.tie(0); vector<int> xs; rep(_, 6) { int w, h; cin >> w >> h; xs.pb(w); xs.pb(h); ctr[mp(w, h)]++; } sort(all(xs)); for (int w : xs) { for (int h : xs) { for (int l : xs) { map<P, int> copy(ctr); copy[mp(w, h)]-=2; copy[mp(h, l)]-=2; copy[mp(l, w)]-=2; bool ok = true; for (auto p : copy) { if (p._2 != 0) ok = false; } if (ok) { cout << "yes\n"; return 0; } } } } cout<<"no\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ int a2,a4,a6,b2,b4,b6,c,q,i,j,z=0,k=1,o=0,m[1001][1001]={0}; int a[1001]={0},b[1001]={0},w[1001]={0},e[6][2]={0}; for(a2=a4=a6=b2=b4=b6=i=0;i<6;i++){ cin>>q>>c; w[q]++; w[c]++; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++){ if(w[i])o++; for(j=0;j<1001;j++){ if(m[i][j]){a[j]+=m[i][j];b[i]+=m[i][j]; if(m[i][j]==4){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else if(m[i][j]==6){e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;e[z][0]=i;e[z++][1]=j;} else{ e[z][0]=i;e[z++][1]=j;} } } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1]||o>3)k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }
#include <iostream> using namespace std; int main(){ int th,tw; int vals[1000000]={}; int uv[1000]={}; int db=0; for (int i=0;i<6;i++){ cin >> th>>tw; if (th>tw)swap(th,tw); vals[(th-1)*1000+(tw-1)]++; uv[th]++; uv[tw]++; if (th==tw){ if (db==0)db=th; else if (db!=th){ cout << "no"<<endl; return 0; } } } for (int i=0;i<1000;i++){ for (int j=0;j<1000;j++){ if (vals[i*1000+j]%2){ cout <<"no"<<endl; return 0; } } if (uv[i]%4){ cout <<"no"<<endl; return 0; } } cout << "yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define pb push_back #define all(r) (r).begin(),(r).end() #define rall(r) (r).rbegin(),(r).rend() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; const ll MOD = 1e9 + 7; double EPS = 1e-8; int main(){ map<pii, int> m; rep(i, 6) { int a, b; cin>>a>>b; if(a > b) swap(a, b); m[{a, b}]++; } map<int, int> m2; for(auto& p : m) if(p.se & 1) { cout<<"no"<<endl; return 0; }else m2[p.fi.fi]+=p.se, m2[p.fi.se]+=p.se; vi v; for(auto& p: m2) rep(i, p.se/4) v.pb(p.fi); if(v.size()!=3) { cout<<"no"<<endl; return 0; } int a = v[0], b = v[1], c = v[2]; if(m.count({a, b}) && m.count({b, c}) && m.count({a, c})) cout<<"yes"<<endl; else cout<<"no"<<endl; }
#include <stdio.h> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 using namespace std; struct Info{ int small,big; }; int main(){ Info info[6]; int left,right; for(int i = 0; i < 6; i++){ scanf("%d %d",&left,&right); if(left <= right){ info[i].small = left; info[i].big = right; }else{ info[i].small = right; info[i].big = left; } } for(int i = 1; i <= 5; i++){ for(int k = 5; k >= i; k--){ if((info[k].small < info[k-1].small) || (info[k].small == info[k-1].small && info[k].big < info[k-1].big)){ swap(info[k],info[k-1]); } } } if(info[0].small == info[1].small && info[0].big == info[1].big && info[2].small == info[3].small && info[2].big == info[3].big && info[4].small == info[5].small && info[4].big == info[5].big && info[0].small == info[2].small ){ //Do nothing }else{ printf("no\n"); return 0; } if(info[0].big > info[2].big){ if(info[0].big == info[4].big && info[2].big == info[4].small){ printf("yes\n"); }else{ printf("no\n"); } }else{ if(info[0].big == info[4].small && info[2].big == info[4].big){ printf("yes\n"); }else{ printf("no\n"); } } return 0; }
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int,int> Paint; int main(){ vector<Paint> a; for(int i = 0; 6 > i; i++){ int te,mp;cin>>te>>mp; if(te < mp)swap(te,mp); a.push_back(make_pair(te,mp)); } sort(a.begin(),a.end()); vector<int> b; for(int i = 0; 6 > i; i+=2){ if(!(a[i].first==a[i+1].first&&a[i].second==a[i+1].second)){ cout << "no" << endl; return 0; }else{ b.push_back(a[i].first); b.push_back(a[i].second); } } int x = b[0]; int y = b[1]; for(int i = 2; 4 > i; i++){//23 for(int j = 4; 6 > j; j++){//45 if(min(x,y) == min(b[i],b[j]) && max(x,y) == max(b[i],b[j])){ if(b[(i==2?3:2)] == b[(j==4?5:4)]){ cout << "yes" << endl; return 0; } } } } cout << "no" << endl; }
// template.cpp {{{ #include <bits/stdc++.h> using namespace std; using lint = long long; #define reps(i, a, n) for (lint i = (a); i < (lint)(n); ++i) #define rep(i, n) reps(i, 0, n) struct pre_{pre_(){cin.tie(0);ios::sync_with_stdio(0);}} pre__; // }}} #define fi first #define se second signed main() { pair<int, int> p[6]; rep(i, 6) cin >> p[i].fi >> p[i].se; rep(i, 6) { if (p[i].fi > p[i].se) { swap(p[i].fi, p[i].se); } } sort(p, p + 6); if (p[0] != p[1] || p[2] != p[3] || p[4] != p[5]) { cout << "no" << endl; } else if (p[0].fi != p[2].fi || p[0].se != p[4].fi) { cout << "no" << endl; } else if (p[2].se != p[4].se) { cout << "no" << endl; } else { cout << "yes" << endl; } }
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;++i) #define rep(i,n) REP(i,0,n) using namespace std; typedef pair<int,int> ii; int h[6],w[6]; bool check(map<ii,int> &mp) { rep(i,6) { if( mp[ii(h[i],w[i])] < 2 ) continue; set<int> base; for(auto v : mp) if( v.second ) { base.insert(v.first.first); base.insert(v.first.second); } for(auto v : base) { map<ii,int> mp2; mp2[ii(h[i],w[i])] += 2; rep(j,2) { ii s = ii(h[i],v); if( s.first > s.second ) swap(s.first,s.second); ++mp2[s]; } rep(j,2) { ii s = ii(w[i],v); if( s.first > s.second ) swap(s.first,s.second); ++mp2[s]; } if( mp2 == mp ) return true; } } return false; } int main() { map<ii,int> mp; rep(i,6) { cin >> h[i] >> w[i]; if( h[i] > w[i] ) swap(h[i],w[i]); ++mp[ii(h[i],w[i])]; } puts(check(mp)?"yes":"no"); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define rep(i, a, n) for(int i = (a); i < (n); i++) #define dep(i, a, n) for(int i = (a); i >= (n); i--) #define mod 1e9+7 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } int main() { map<P, int> mp; for(int i = 0; i < 6; i++) { int a, b; cin >> a >> b; if(a > b) mp[P(b, a)]++; else mp[P(a, b)]++; } if(mp.size() > 3) { cout << "no" << endl; return 0; } if(mp.size() == 1) { map<P, int>::iterator it = mp.begin(); if(it->first.first == it->first.second) cout << "yes" << endl; else cout << "no" << endl; return 0; } vector<P> v; for(map<P, int>::iterator it = mp.begin(); it != mp.end(); it++) { if(it->second == 2 || it->second == 4) { v.pb(P(it->first.first, it->first.second)); }else { cout << "no" << endl; return 0; } } if(v.size() == 2) { if(v[0].first == v[0].second) { if(v[0].first == v[1].first || v[0].first == v[1].second) cout << "yes" << endl; else cout << "no" << endl; return 0; }else if(v[1].first == v[1].second) { if(v[1].first == v[0].first || v[1].first == v[0].second) cout << "yes" << endl; else cout << "no" << endl; return 0; }else { cout << "no" << endl; } }else if(v.size() == 3) { if(v[0].first == v[1].first) { if(v[0].second == v[2].first) { if(v[1].second == v[2].second) cout << "yes" << endl; else cout << "no" << endl; }else if(v[0].second == v[2].second) { if(v[1].second == v[2].first) cout << "yes" << endl; else cout << "no" << endl; }else { cout << "no" << endl; } }else if(v[0].first == v[1].second) { if(v[0].second == v[2].first) { if(v[1].first == v[2].second) cout << "yes" << endl; else cout << "no" << endl; }else if(v[0].second == v[2].second) { if(v[1].first == v[2].first) cout << "yes" << endl; else cout << "no" << endl; }else { cout << "no" << endl; } }else if(v[0].first == v[2].first) { if(v[0].second == v[1].first) { if(v[2].second == v[1].second) cout << "yes" << endl; else cout << "no" << endl; }else if(v[0].second == v[1].second) { if(v[2].second == v[1].first) cout << "yes" << endl; else cout << "no" << endl; }else { cout << "no" << endl; } }else if(v[0].first == v[2].second) { if(v[0].second == v[1].first) { if(v[2].first == v[1].second) cout << "yes" << endl; else cout << "no" << endl; }else if(v[0].second == v[1].second) { if(v[2].first == v[1].first) cout << "yes" << endl; else cout << "no" << endl; }else { cout << "no" << endl; } }else { cout << "no" << endl; } } }
#include <iostream> #include <map> using namespace std; typedef pair<int,int> P; int main(){ int h[6],w[6]; map<P,int> mp; map<int,int> mpp; for(int i = 0;i < 6;i++){ cin >> h[i] >> w[i]; if(h[i] > w[i]) swap(h[i],w[i]); mp[P(h[i],w[i])]++; mpp[h[i]]++; mpp[w[i]]++; } bool flag = true; if(mp.size() >= 4) flag = false; if(mpp.size() >= 4) flag = false; if(mpp.size() == 2){ int same = 0; for(int i = 0;i < 6;i++){ if(w[i] == h[i]) same++; } if(same != 2) flag = false; if(mp.size() != 2) flag = false; }else if(mpp.size() == 3){ if(mp.size() != 3) flag = false; for(auto it = mp.begin();it != mp.end();it++){ if(it->first.first == it->first.second) flag = false; if(it->second != 2) flag = false; } } if(flag) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { pair<int,int> a[6];for(int i=0;i<6;i++){ cin>>a[i].first>>a[i].second; if(a[i].first>a[i].second){ int tmp=a[i].first; a[i].first=a[i].second; a[i].second=tmp; } } sort(a,a+6); set<int>s; if(a[0]==a[1]){ s.insert(a[0].first); s.insert(a[1].second); if(a[2]==a[3]){ s.insert(a[2].first); s.insert(a[3].second); if(a[4]==a[5]){ s.insert(a[4].first); s.insert(a[5].second); if(s.size()==1)cout<<"yes\n"; else if(s.size()==2){ if(a[0]==a[2]&&a[2]==a[4])cout<<"no\n"; else cout<<"yes\n"; } else if(s.size()==3){ for(int i=0;i<6;i++){ if(a[i].first==a[i].second){ cout<<"no\n"; return 0; } } cout<<"yes\n"; } else cout<<"no\n"; }else cout<<"no\n"; }else cout<<"no\n"; }else cout<<"no\n"; return 0; }
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208; int main() { vector<pair<int, int>> v(6); vector<int> a; for (int i = 0; i < 6; ++i) { cin >> v[i].first >> v[i].second; if(v[i].first > v[i].second) swap(v[i].first, v[i].second); a.emplace_back(v[i].first); a.emplace_back(v[i].second); } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); if(a.size() >= 4) { puts("no"); return 0; } sort(v.begin(),v.end()); for (auto &&i : a) { for (auto &&j : a) { for (auto &&k : a) { vector<pair<int, int>> v2{minmax(i, j), minmax(i, j), minmax(k, j), minmax(k, j), minmax(i, k), minmax(i, k)}; sort(v2.begin(),v2.end()); if(v == v2) { puts("yes"); return 0; } } } } puts("no"); return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ int c,q,i,j,z=0,k=1,m[1001][1001]={0},e[6][2]={0}; for(i=0;i<6;i++){ cin>>q>>c; if(q>c)m[q][c]++; else m[c][q]++; } for(i=0;i<1001;i++)for(j=0;j<1001;j++){ if(m[i][j]){ if(m[i][j]%2==0)for(c=0;c<m[i][j]/2;c++){e[z][0]=i;e[z++][1]=j;} else {e[z][0]=i;e[z++][1]=j;} } } if(e[0][0]!=e[2][1]||e[1][0]!=e[2][0]||e[0][1]!=e[1][1])k=0; if(k)cout<<"yes"<<endl; else cout<<"no"<<endl; }
#include<bits/stdc++.h> using namespace std; int main(){ int h[10]={},w[10]={}; int s[10]={}; int x; bool flag = true; for(int i=0; i<6; i++){ cin >> h[i] >> w[i]; if(h[i] > w[i]) swap(h[i],w[i]); s[i] = h[i] * w[i]; } sort(h,h+6); sort(w,w+6); sort(s,s+6); /* for(int i=0; i<6; i++) cout << h[i] << " "; cout << endl; for(int i=0; i<6; i++) cout << w[i] << " "; */ // for(int i=0; i<6; i++) cout << s[i] << " "; if(h[0]!=h[1] || h[2] != h[3] || h[4] != h[5] && w[0]!=w[1] || w[2] != w[3] || w[4] != w[5]){ cout << "no" << endl; //cout << "hey" << endl; } else if(h[0] !=h[2] || w[0] != h[4] || w[2] != w[4]) cout << "no" << endl; else if(s[0]!=s[1] || s[2] != s[3] || s[4] != s[5]) cout << "no" << endl; else cout << "yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { pair< int, int > Q[6]; for(int i = 0; i < 6; i++) { cin >> Q[i].first >> Q[i].second; if(Q[i].first > Q[i].second) swap(Q[i].first, Q[i].second); } sort(Q, Q + 6); if(Q[0] == Q[1] && Q[2] == Q[3] && Q[4] == Q[5] && Q[0].first == Q[2].first && Q[2].second == Q[4].second && Q[0].second == Q[4].first) { cout << "yes" << endl; } else { cout << "no" << endl; } }
#include<cstdio> #include<algorithm> using namespace std; typedef pair<int,int> PA; int main(){ int h,w; PA p[6]; for(int i=0;i<6;i++){ scanf("%d %d",&h,&w); p[i] = PA(min(h,w),max(h,w)); } sort(p,p+6); if(p[0]==p[1]&&p[2]==p[3]&&p[4]==p[5]&&p[0].first==p[2].first&&p[2].second==p[4].second&&p[0].second==p[4].first) puts("yes"); else puts("no"); return(0); }
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> P; P t[6]; bool solve(){ if(t[0]!=t[1]||t[2]!=t[3]||t[4]!=t[5])return false; return (t[0].first==t[2].first&&t[0].second==t[4].first&&t[2].second==t[4].second); } int main(){ for(int i=0;i<6;i++){ int a,b; cin>>a>>b; if(a>b)swap(a,b); t[i]=P(a,b); } sort(t,t+6); cout<< (solve()?"yes":"no") <<endl; return 0; }
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <list> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <unordered_set> #include <unordered_map> #include <array> #include <cassert> #include <bitset> using namespace std; using LL = long long; int main(void) { map<pair<int, int>, int>cnt; set<int>s; for (int i = 0; i < 6; ++i) { int h, w; cin >> h >> w; if (h > w)swap(h, w); cnt[{h, w}] ++; s.insert(h); s.insert(w); } if (s.size() == 3) { auto itr = s.begin(); int a = *itr; ++itr; int b = *itr; ++itr; int c = *itr; if (cnt[{min(a, b), max(a, b)}] == 2 && cnt[{min(c, b), max(c, b)}] == 2 && cnt[{min(a, c), max(a, c)}] == 2) { cout << "yes\n"; } else { cout << "no\n"; } } else if (s.size() == 2) { auto itr = s.begin(); int a = *itr; ++itr; int b = *itr; if (cnt[{min(a, b), max(a, b)}] == 4 && cnt[{a, a}] == 2) { cout << "yes\n"; } else if (cnt[{min(a, b), max(a, b)}] == 4 && cnt[{b, b}] == 2) { cout << "yes\n"; } else { cout << "no\n"; } } else if (s.size() == 1) { auto itr = s.begin(); int a = *itr; if (cnt[{a, a}] == 6) { cout << "yes\n"; } else { cout << "no\n"; } } else { cout << "no\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { vector<P> v(6); for(int i=0; i<6; ++i) { cin >> v[i].first >> v[i].second; if(v[i].first > v[i].second) { swap(v[i].first, v[i].second); } } sort(v.begin(), v.end()); if(v[0] != v[1] || v[2] != v[3] || v[4] != v[5] || v[0].first != v[2].first || v[0].second != v[4].first || v[2].second != v[4].second) { cout << "no" << endl; } else { cout << "yes" << endl; } }
#include<iostream> #include<vector> #include<algorithm> using namespace std; int b[6][2] = { {0,1}, {0,1}, {0,2}, {0,2}, {1,2}, {1,2} }; int main(){ vector<pair<int,int>> v; int x, y; for(int i = 0; i < 6; i++){ cin >> x >> y; if(x > y) swap(x, y); v.push_back({x, y}); } sort(v.begin(), v.end()); bool judge = false; do{ int a[3] = {v[0].first, v[0].second, v[2].second}; bool inner = true; for(int i = 0; i < 6; i++){ inner &= v[i].first == a[b[i][0]]; inner &= v[i].second == a[b[i][1]]; } if(inner) judge = true; }while(next_permutation(v.begin(), v.end())); if(judge) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; int h[6], w[6]; int main() { map<int, int>t; rep(i, 6) { cin >> h[i] >> w[i]; t[h[i]]++; if (h[i] != w[i])t[w[i]]++; } if (t.size() > 3) { puts("no"); return 0; } if (t.size() == 1)puts("yes"); if (t.size() == 2) { auto p1 = *t.begin(), p2 = *t.rbegin(); if ((p1.second == 6 && p2.second == 4) || (p1.second == 4 && p2.second == 6))puts("yes"); else puts("no"); } if (t.size() == 3) { auto p1 = *t.begin(), p2 = *++t.begin(), p3 = *t.rbegin(); if (p1.second == 4 && p2.second == 4 && p3.second == 4)puts("yes"); else puts("no"); } }
//Kinniku kaihou #include <iostream> #include <algorithm> using namespace std; int h[6], w[6]; int main() { int i, j, k, l; int len[12]; for (i = 0; i < 6; i++) { cin >> h[i] >> w[i]; len[2 * i] = h[i]; len[2 * i + 1] = w[i]; } sort(len, len + 12); for (i = 0; i < 12; i++) { for (j = i + 1; j < 12; j++) { for (k = j + 1; k < 12; k++) { int a[6]; a[0] = len[i] * 2000 + len[j]; a[1] = len[i] * 2000 + len[j]; a[2] = len[j] * 2000 + len[k]; a[3] = len[j] * 2000 + len[k]; a[4] = len[i] * 2000 + len[k]; a[5] = len[i] * 2000 + len[k]; int b[6]; for (l = 0; l < 6; l++) { if (h[l] < w[l]) { b[l] = h[l] * 2000 + w[l]; } else { b[l] = w[l] * 2000 + h[l]; } } sort(a, a + 6); sort(b, b + 6); for (l = 0; l < 6; l++) { if (a[l] != b[l]) { break; } } if (l == 6) { cout << "yes" << endl; return 0; } } } } cout << "no" << endl; return 0; }