#include<bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); #define mod 998244353 #define ll long long #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3f inline int read() { char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();} int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();} if(nega==-1) return -ans; return ans; } void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);} signed main() { int n=18; vector<int> a(n),b(n); int sa=0,sb=0; for(int i=0;i<n;i++) { a[i]=read(); sa+=a[i]; } for(int i=0;i<n;i++) { b[i]=read(); sb+=b[i]; } if(sa<sb) cout<<"Bajtek\n"; else if(sa>sb) cout<<"Algosia\n"; else { sort(a.begin(),a.end(),greater<int>()); sort(b.begin(),b.end(),greater<int>()); int ok=0; for(int i=0;i<n;i++) { if(a[i]!=b[i]) { ok=1; if(a[i]<b[i]) cout<<"Bajtek\n"; else if(a[i]>b[i]) cout<<"Algosia\n"; break; } } if(!ok) cout<<"remis\n"; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include<bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); #define mod 998244353 #define ll long long #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3f inline int read() { char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();} int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();} if(nega==-1) return -ans; return ans; } void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);} signed main() { int n=18; vector<int> a(n),b(n); int sa=0,sb=0; for(int i=0;i<n;i++) { a[i]=read(); sa+=a[i]; } for(int i=0;i<n;i++) { b[i]=read(); sb+=b[i]; } if(sa<sb) cout<<"Bajtek\n"; else if(sa>sb) cout<<"Algosia\n"; else { sort(a.begin(),a.end(),greater<int>()); sort(b.begin(),b.end(),greater<int>()); int ok=0; for(int i=0;i<n;i++) { if(a[i]!=b[i]) { ok=1; if(a[i]<b[i]) cout<<"Bajtek\n"; else if(a[i]>b[i]) cout<<"Algosia\n"; break; } } if(!ok) cout<<"remis\n"; } return 0; } |