Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int,int>
- #define vec vector
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvl(vector <ll> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvv(vector <vector <int> > &v){
- for (auto x: v) cv(x);
- cout<<"\n";
- }
- void cvb(vector <bool> v){
- for (bool x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvs(vector <string> v){
- for (auto a: v){
- cout<<a<<"\n";
- }
- }
- void cvp(vector <pii> a){
- for (auto p: a){
- cout<<p.first<<' '<<p.second<<"\n";
- }
- cout<<"\n";
- }
- int Sum(pii p){
- return p.first + p.second;
- }
- pii fmax(pii p){
- pii a,b;
- a = {p.first*2, p.second};
- b = {p.first, p.second*3};
- if (Sum(a) > Sum(b)){
- swap(a,b);
- }
- return b;
- }
- pii fmin(pii p){
- pii a = {p.first + 1, p.second}, b = {p.first, p.second + 1};
- if (Sum(fmax(a)) > Sum(fmax(b))){
- swap(a,b);
- }
- return a;
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- vector <vector <int> > var = {{0,0}, {1,0}, {0,1}, {1,1}};
- int ans=100;
- pii p;
- for (int s=1;s<=67;++s){
- p = {16,s};
- vector <bool> win;
- for (auto v: var){
- for (int i: v){
- if (i==1){
- p = fmax(p);
- }
- else{
- p = fmin(p);
- }
- }
- if (Sum(fmax(p)) < 84){
- p = fmin(p);
- p = fmax(p);
- if (Sum(p) >= 84){
- win.push_back(1);
- }
- else{
- win.push_back(0);
- }
- }
- else{
- win.push_back(0);
- }
- }
- bool can = (win[0] || win[1]) && (win[2] || win[3]);
- if (can){
- ans=s;
- break;
- }
- }
- cout<<ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement