solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
# []paper ()rock 8<scissors beats=[('[]','()'), ('()','8<'), ('8<','[]')] a = input() b = input() if len(a) % 2: raise "Ho" sc1=0 sc2=0 for i in range(0, len(a), 2): x = a[i:i+2] y = b[i:i+2] if (x, y) in beats: sc1 += 1 elif x != y: sc2 += 1 if sc1==sc2: print("TIE") else: print("TEAM %d WINS" % (1 if sc1>sc2 else 2))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int team1, team2; string s, ss; const int INF = 10e9; int main() { ios_base::sync_with_stdio(false); cin >> s; cin >> ss; for (int i = 0; i < s.size(); i++) { if (s[i] == '[') { if (ss[i] == '(') team1++; if (ss[i] == '8') team2++; } if (s[i] == '(') { if (ss[i] == '8') team1++; if (ss[i] == '[') team2++; } if (s[i] == '8') { if (ss[i] == '[') team1++; if (ss[i] == '(') team2++; } } if (team1 > team2) cout << "TEAM 1 WINS"; else if (team2 > team1) cout << "TEAM 2 WINS"; else cout << "TIE"; }
7
CPP
#include <bits/stdc++.h> using namespace std; int P1, P2; string T1, T2; int main() { cin >> T1; cin >> T2; for (int i = 0; i < T1.length(); i += 2) { if (T1[i] == T2[i]) continue; if (T1[i] == '[' && T2[i] == '8') P2++; if (T1[i] == '[' && T2[i] == '(') P1++; if (T1[i] == '8' && T2[i] == '[') P1++; if (T1[i] == '8' && T2[i] == '(') P2++; if (T1[i] == '(' && T2[i] == '8') P1++; if (T1[i] == '(' && T2[i] == '[') P2++; } if (P1 == P2) cout << "TIE\n"; else if (P1 < P2) cout << "TEAM 2 WINS\n"; else cout << "TEAM 1 WINS\n"; }
7
CPP
s1 = input() s2 = input() s1= s1.replace("[]","1") s1= s1.replace("()","2") s1= s1.replace("8<","3") s2= s2.replace("[]","1") s2= s2.replace("()","2") s2= s2.replace("8<","3") cnt=0 for x,y in zip(s1,s2): if x==y : continue if x=='1' and y=='2': cnt+=1 elif x=='1' and y=='3': cnt-=1 elif x=='2' and y=='1': cnt-=1 elif x=='2' and y=='3': cnt+=1 elif x=='3' and y=='1': cnt+=1 else: cnt-=1 if cnt>0 : print("TEAM 1 WINS") elif cnt==0: print("TIE") else: print("TEAM 2 WINS")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { string f, s; int a = 0, d = 0, t; cin >> f >> s; t = s.size(); for (int i = 0; i <= t; i += 2) { if (s[i] == '8' && f[i] == '[') { d++; } else if (s[i] == '[' && f[i] == '(') { d++; } else if (s[i] == '(' && f[i] == '8') { d++; } else if (f[i] == '(' && s[i] == '8') { a++; } else if (f[i] == '[' && s[i] == '(') { a++; } else if (f[i] == '8' && s[i] == '[') { a++; } } if (a > d) { cout << "TEAM 1 WINS"; } else if (a < d) { cout << "TEAM 2 WINS"; } else { cout << "TIE"; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char str1[22], str2[22]; gets(str1); gets(str2); int a = 0, b = 0; int i = 0; while (str1[i] != '\0') { if (str1[i] == '[') { if (str2[i] == '(') a++; if (str2[i] == '8') b++; } else if (str1[i] == '8') { if (str2[i] == '[') a++; if (str2[i] == '(') b++; } else if (str1[i] == '(') { if (str2[i] == '8') a++; if (str2[i] == '[') b++; } i += 2; } if (a > b) printf("TEAM 1 WINS\n"); else if (a == b) printf("TIE\n"); else if (a < b) printf("TEAM 2 WINS\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; template <typename T> T abs(T x) { return x > 0 ? x : -x; } long long a[16] = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 20, 25, 134, 10000, 663268, 154103, 1642, 106, }; int main() { char str1[30], str2[30]; cin.getline(str1, 100); cin.getline(str2, 100); assert((strlen(str1) & 1) == 0); int res1 = 0; int res2 = 0; for (int i = 0; i < strlen(str1); i += 2) { if (str1[i] == '[') { if (str2[i] == '8') { res1--; } else if (str2[i] == '(') res1++; } else if (str1[i] == '(') { if (str2[i] == '8') res1++; else if (str2[i] == '[') res1--; } else { if (str2[i] == '(') res1--; else if (str2[i] == '[') res1++; } } if (res1 > 0) { puts("TEAM 1 WINS"); } else if (res1 == 0) { puts("TIE"); } else { puts("TEAM 2 WINS"); } return 0; }
7
CPP
# from dust i have come dust i will be def move(ch1): if ch1 == '8': return 3 elif ch1 == '[': return 2 return 1 s = input() t = input() cnt1 = 0; cnt2 = 0 for i in range(0, len(s), 2): x = move(s[i]) y = move(t[i]) if x == 1 and y == 2: cnt2 += 1 if x == 1 and y == 3: cnt1 += 1 if x == 2 and y == 1: cnt1 += 1 if x == 2 and y == 3: cnt2 += 1 if x == 3 and y == 2: cnt1 += 1 if x == 3 and y == 1: cnt2 += 1 if cnt1 == cnt2: print('TIE') elif cnt1 > cnt2: print('TEAM 1 WINS') else: print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { char str_1[22], str_2[22]; int count = 0; cin >> str_1 >> str_2; for (int i = 0; str_1[i]; i += 2) { char s1, s2; s1 = str_1[i]; s2 = str_2[i]; if (s1 == '[') { if (s2 == '(') count++; if (s2 == '8') count--; } if (s1 == '(') { if (s2 == '[') count--; if (s2 == '8') count++; } if (s1 == '8') { if (s2 == '(') count--; if (s2 == '[') count++; } } if (!count) cout << "TIE"; else if (count > 0) cout << "TEAM 1 WINS"; else cout << "TEAM 2 WINS"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; char a[100]; char b[100]; int l; int cnt[2]; int main() { scanf("%s%s", a, b); l = strlen(a); for (int i = 0; i < l; i += 2) { if (a[i] == '8' && b[i] == '[') cnt[0]++; if (a[i] == '8' && b[i] == '(') cnt[1]++; if (a[i] == '(' && b[i] == '8') cnt[0]++; if (a[i] == '(' && b[i] == '[') cnt[1]++; if (a[i] == '[' && b[i] == '(') cnt[0]++; if (a[i] == '[' && b[i] == '8') cnt[1]++; } if (cnt[0] > cnt[1]) printf("TEAM 1 WINS"); if (cnt[0] < cnt[1]) printf("TEAM 2 WINS"); if (cnt[0] == cnt[1]) printf("TIE"); printf("\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; template <class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; } template <class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> T sqr(T x) { return x * x; } template <class T> T cube(T x) { return x * x * x; } template <class T> int getbit(T s, int i) { return (s >> i) & 1; } template <class T> T onbit(T s, int i) { return s | (T(1) << i); } template <class T> T offbit(T s, int i) { return s & (~(T(1) << i)); } template <class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); } template <class T> int disp(T s) { for (__typeof(((s)).begin()) it = ((s)).begin(); it != ((s)).end(); ++it) cout << *it << " "; cout << endl; } template <class T> int disp(T s, int n) { for (int i = (1); i <= (n); ++i) cout << s[i] << " "; cout << '\n'; } const long double PI = acos(-1.0); const long double eps = 1e-9; const int dr[] = {-1, 0, +1, 0, -1, -1, +1, +1}; const int dc[] = {0, +1, 0, -1, -1, +1, -1, +1}; const int inf = (int)1e9 + 5; const long long linf = (long long)1e16 + 5; const long long mod = (long long)1e9 + 7; const int MX = (int)2e5 + 5; string s1, s2; int main() { std::ios::sync_with_stdio(false); cin.tie(NULL); cin >> s1 >> s2; int ans1 = 0; int ans2 = 0; for (int i = 0; i < (((int)(s1).size())); ++i) { if (i & 1) continue; if (s1[i] == '[') { if (s2[i] == '(') ans1++; else if (s2[i] == '8') ans2++; } if (s1[i] == '(') { if (s2[i] == '8') ans1++; else if (s2[i] == '[') ans2++; } if (s1[i] == '8') { if (s2[i] == '[') ans1++; else if (s2[i] == '(') ans2++; } } if (ans1 > ans2) { cout << "TEAM 1 WINS" << '\n'; } else if (ans1 == ans2) { cout << "TIE" << '\n'; } else { cout << "TEAM 2 WINS" << '\n'; } }
7
CPP
#include <bits/stdc++.h> using namespace std; string s1, s2; int main() { cin >> s1; cin >> s2; int p1 = 0, p2 = 0; for (int i = 0; i < s1.size(); i += 2) { int x, y; if (s1[i] == '(') x = 0; if (s1[i] == '8') x = 1; if (s1[i] == '[') x = 2; if (s2[i] == '(') y = 0; if (s2[i] == '8') y = 1; if (s2[i] == '[') y = 2; if (x == 0 && y == 1) p1++; if (x == 0 && y == 2) p2++; if (x == 1 && y == 0) p2++; if (x == 1 && y == 2) p1++; if (x == 2 && y == 0) p1++; if (x == 2 && y == 1) p2++; } if (p1 > p2) cout << "TEAM 1 WINS\n"; if (p1 < p2) cout << "TEAM 2 WINS\n"; if (p1 == p2) cout << "TIE\n"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; int l1, l2; l1 = s1.length(); int i; int ans = 0; for (i = 0; i < l1; i += 2) { if (s1[i] == '(' && s2[i] == '[') ans++; if (s1[i] == '(' && s2[i] == '8') ans--; if (s1[i] == '8' && s2[i] == '[') ans--; if (s1[i] == '8' && s2[i] == '(') ans++; if (s1[i] == '[' && s2[i] == '8') ans++; if (s1[i] == '[' && s2[i] == '(') ans--; } if (ans > 0) cout << "TEAM 2 WINS" << endl; else if (ans < 0) cout << "TEAM 1 WINS" << endl; else if (ans == 0) cout << "TIE" << endl; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char a[21], b[21]; scanf("%s%s", a, b); int cnt1 = 0, cnt2 = 0; int len = strlen(a); for (int i = 0; i < len; i += 2) { if (a[i] == '8') { if (b[i] == '[') { cnt1++; } else if (b[i] == '(') { cnt2++; } } else if (a[i] == '[') { if (b[i] == '(') { cnt1++; } else if (b[i] == '8') { cnt2++; } } else if (a[i] == '(') { if (b[i] == '8') { cnt1++; } else if (b[i] == '[') { cnt2++; } } } if (cnt1 > cnt2) { printf("TEAM 1 WINS\n"); } else if (cnt1 < cnt2) { printf("TEAM 2 WINS\n"); } else { printf("TIE\n"); } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; string s1, s2; int a, b; int main() { cin >> s1 >> s2; for (int i = 0; i < (int)s1.size(); i += 2) { if ((s1[i] == '8' && s2[i] == '[') || (s1[i] == '[' && s2[i] == '(') || (s1[i] == '(' && s2[i] == '8')) a++; else if (s1[i] != s2[i]) b++; } if (a > b) cout << "TEAM 1 WINS"; else if (b > a) cout << "TEAM 2 WINS"; else cout << "TIE"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; class process { private: vector<string> args; vector<int> path; public: vector<string> get_args() { return args; } void set_args(vector<string> args) { this->args = args; } vector<int> get_path() { return path; } void set_path(vector<int> path) { this->path = path; } friend ostream &operator<<(ostream &out, process p) { out << "args : \n"; vector<string> args = p.get_args(); vector<int> path = p.get_path(); for (int i = 0; (i) < (int((args).size())); i++) { out << args[i] << " "; } out << endl; out << "path : \n"; for (int i = 0; (i) < (int((path).size())); i++) { cout << path[i] << " "; } cout << endl; return out; } }; vector<process> processes; int main() { string str1, str2; cin >> str1 >> str2; vector<int> vi1, vi2; for (int i = 0; (i) < (int((str1).size())); i++) { if (str1[i] == '[') vi1.push_back(2); else if (str1[i] == '(') vi1.push_back(1); else vi1.push_back(3); i++; } for (int i = 0; (i) < (int((str2).size())); i++) { if (str2[i] == '[') vi2.push_back(2); else if (str2[i] == '(') vi2.push_back(1); else vi2.push_back(3); i++; } int cnt1 = 0, cnt2 = 0; for (int i = 0; (i) < (int((vi1).size())); i++) { if (vi1[i] == vi2[i]) continue; else if (vi1[i] == 1) { if (vi2[i] == 2) cnt2++; else cnt1++; } else if (vi1[i] == 2) { if (vi2[i] == 3) cnt2++; else cnt1++; } else { if (vi2[i] == 1) cnt2++; else cnt1++; } } if (cnt1 > cnt2) { cout << "TEAM 1 WINS" << endl; } else if (cnt1 < cnt2) { cout << "TEAM 2 WINS" << endl; } else cout << "TIE" << endl; return 0; }
7
CPP
#!/bin/bash/python # Date: 2014-04-16 # Author: shijinzhan # Status: # Note: '()' < '[]' # '[]' < '8<' # '8<' < '()' team1 = input().replace('(', '6').replace('[', '7') team2 = input().replace('(', '6').replace('[', '7') s = 0 for x in range(0, len(team1), 2): if team1[x] > team2[x]: s += 1 elif team1[x] < team2[x]: s -= 1 if team1[x] == '6' and team2[x] == '8': s += 2 if team1[x] == '8' and team2[x] == '6': s -= 2 if s > 0: print("TEAM 1 WINS") elif s < 0: print("TEAM 2 WINS") else: print("TIE")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int y = 0, x = 0; string a, b; cin >> a >> b; for (int i = 0; i < b.size(); i += 2) { if ((a[i] == '8' && b[i] == '[') || (a[i] == '[' && b[i] == '(') || (a[i] == '(' && b[i] == '8')) x++; else if (a[i] != b[i]) y++; } if (x > y) cout << "TEAM 1 WINS"; else if (x < y) cout << "TEAM 2 WINS"; else cout << "TIE"; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char a[50], b[50]; int x, sum, i; cin >> a; cin >> b; x = strlen(a); sum = 0; for (i = 0; i <= x - 1; i += 2) { if (a[i] == '(' && a[i + 1] == ')' && b[i] == '8' && b[i + 1] == '<' || a[i] == '8' && a[i + 1] == '<' && b[i] == '[' && b[i + 1] == ']' || a[i] == '[' && a[i + 1] == ']' && b[i] == '(' && b[i + 1] == ')') { sum++; } else if (a[i] == b[i] && a[i + 1] == b[i + 1]) { } else { sum--; } } if (sum == 0) { cout << "TIE" << endl; } else if (sum > 0) { cout << "TEAM 1 WINS" << endl; } else { cout << "TEAM 2 WINS" << endl; } }
7
CPP
#include <bits/stdc++.h> int cnt[2]; int main(void) { int i; char str[2][21]; scanf("%s %s", str, str + 1); for (i = 0; str[0][i * 2] != '\0'; i++) { switch (str[0][i * 2]) { case '(': switch (str[1][i * 2]) { case '(': break; case '8': cnt[0]++; break; case '[': cnt[1]++; break; } break; case '8': switch (str[1][i * 2]) { case '(': cnt[1]++; break; case '8': break; case '[': cnt[0]++; break; } break; case '[': switch (str[1][i * 2]) { case '(': cnt[0]++; break; case '8': cnt[1]++; break; case '[': break; } break; } } puts(cnt[0] > cnt[1] ? "TEAM 1 WINS" : cnt[0] < cnt[1] ? "TEAM 2 WINS" : "TIE"); return 0; }
7
CPP
a = input() b = input() x, y = 0, 0 for i in range(len(a)) : if(a[i] == '(' and b[i] == '8') : x += 1 if(a[i] == '(' and b[i] == '[') : y += 1 if(a[i] == '[' and b[i] == '8') : y += 1 if(a[i] == '[' and b[i] == '(') : x += 1 if(a[i] == '8' and b[i] == '(') : y += 1 if(a[i] == '8' and b[i] == '[') : x += 1 if(x == y) : print('TIE') if(x > y) : print('TEAM 1 WINS') if(x < y) : print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> const int type[128] = {['('] = 0, ['8'] = 1, ['['] = 2}; int cnt[2]; int main(void) { int i; char str[2][21]; scanf("%s %s", str, str + 1); for (i = 0; str[0][i * 2] != '\0'; i++) { cnt[0] += type[str[1][i * 2]] == (type[str[0][i * 2]] + 1) % 3; cnt[1] += type[str[0][i * 2]] == (type[str[1][i * 2]] + 1) % 3; } puts(cnt[0] > cnt[1] ? "TEAM 1 WINS" : cnt[0] < cnt[1] ? "TEAM 2 WINS" : "TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; string s, t; int main() { cin >> s; cin >> t; int a = 0; int b = 0; int n = s.size(); for (int i = 0; i < n; i += 2) { if (s[i] != t[i]) { if ((s[i] == '[' && t[i] == '(') || (s[i] == '(' && t[i] == '8') || (s[i] == '8' && t[i] == '[')) a++; else b++; } } if (a == b) cout << "TIE"; else cout << (a > b ? "TEAM 1 WINS" : "TEAM 2 WINS"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; char str1[200], str2[200]; int s, n; int ff(int x) { if (str1[x] == '8' && str2[x] == '[') return 1; if (str1[x] == '(' && str2[x] == '8') return 1; if (str1[x] == '[' && str2[x] == '(') return 1; if (str2[x] == '8' && str1[x] == '[') return -1; if (str2[x] == '(' && str1[x] == '8') return -1; if (str2[x] == '[' && str1[x] == '(') return -1; return 0; } int main() { scanf("%s", str1); n = strlen(str1); scanf("%s", str2); for (int i = 0; i < n; i += 2) s += ff(i); if (s > 0) cout << "TEAM 1 WINS" << endl; else if (s < 0) cout << "TEAM 2 WINS" << endl; else cout << "TIE" << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; inline string GetString() { char GS[1000005]; scanf("%s", GS); string ret = GS; return ret; } inline char getc() { char c = ' '; while (c == ' ' || c == '\t' || c == '\r' || c == '\n') c = getchar(); return c; } string s1, s2; int i; int w1, w2; int main() { s1 = GetString(); s2 = GetString(); for (i = 0; i < (int)(s1).size(); i += 2) { if (s1[i] == '[' && s2[i] == '8') ++w2; else if (s1[i] == '[' && s2[i] == '(') ++w1; else if (s1[i] == '8' && s2[i] == '[') ++w1; else if (s1[i] == '8' && s2[i] == '(') ++w2; else if (s1[i] == '(' && s2[i] == '[') ++w2; else if (s1[i] == '(' && s2[i] == '8') ++w1; } if (w1 > w2) printf("TEAM 1 WINS\n"); else if (w1 < w2) printf("TEAM 2 WINS\n"); else printf("TIE\n"); }
7
CPP
#include <bits/stdc++.h> using namespace std; int kawsar(char ch) { if (ch == '[') return 0; if (ch == '(') return 1; return 2; } int main() { int a, b, i, j, x, y, p; string k, u; cin >> k >> u; p = k.size(); x = y = 0; for (i = 0; i < p; i += 2) { if (k[i] != u[i]) { a = kawsar(k[i]); b = kawsar(u[i]); if (a == 0 && b == 1) x++; else if (a == 0 && b == 2) y++; else if (b == 0 && a == 1) y++; else if (b == 0 && a == 2) x++; else if (b == 1 && a == 2) y++; else x++; } } if (x == y) cout << "TIE" << endl; else if (x > y) cout << "TEAM 1 WINS" << endl; else if (x < y) cout << "TEAM 2 WINS" << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; int l = s1.length(), i, sum = 0; l /= 2; for (i = 0; i < l; i++) { if (s1[i * 2] != s2[i * 2]) { if (s1[i * 2] == '[' && s2[i * 2] == '(' || s1[i * 2] == '(' && s2[i * 2] == '8' || s1[i * 2] == '8' && s2[i * 2] == '[') sum++; else sum--; } } if (sum == 0) cout << "TIE" << endl; if (sum > 0) cout << "TEAM 1 WINS" << endl; if (sum < 0) cout << "TEAM 2 WINS" << endl; return (0); }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int i, j, res = 0; string str, str2; cin >> str >> str2; for (i = 0; i < str.size(); i += 2) { if (str[i] == '[') { if (str2[i] == '8') res--; else if (str2[i] == '(') res++; } else if (str[i] == '(') { if (str2[i] == '8') res++; else if (str2[i] == '[') res--; } else { if (str2[i] == '(') res--; else if (str2[i] == '[') res++; } } if (res > 0) puts("TEAM 1 WINS"); else if (res < 0) puts("TEAM 2 WINS"); else puts("TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; string valor(string cad1, string cad2) { int a = 0, b = 0; for (int i = 0; i < cad1.size(); i += 2) { string s1 = cad1.substr(i, 2); string s2 = cad2.substr(i, 2); if (s1 == "[]" && s2 == "()") a++; if (s2 == "[]" && s1 == "()") b++; if (s1 == "[]" && s2 == "8<") b++; if (s2 == "[]" && s1 == "8<") a++; if (s1 == "()" && s2 == "8<") a++; if (s2 == "()" && s1 == "8<") b++; } if (a > b) return "TEAM 1 WINS"; else if (a < b) return "TEAM 2 WINS"; return "TIE"; } int main() { string cad, cad2; cin >> cad >> cad2; cout << valor(cad, cad2); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char str1[25], str2[25]; while (~scanf("%s%s", str1, str2)) { int len = strlen(str1); int a = 0, b = 0; for (int i = 0; i < len; i += 2) { if (str1[i] == '[' && str2[i] == '8') b++; else if (str1[i] == '8' && str2[i] == '[') a++; else if (str1[i] == '[' && str2[i] == '(') a++; else if (str1[i] == '(' && str2[i] == '[') b++; else if (str1[i] == '8' && str2[i] == '(') b++; else if (str1[i] == '(' && str2[i] == '8') a++; } if (a > b) printf("TEAM 1 WINS\n"); else if (a == b) printf("TIE\n"); else printf("TEAM 2 WINS\n"); } return 0; }
7
CPP
__author__ = 'Pavel Mavrin' a = input().strip() b = input().strip() n = len(a) // 2 x = 0 figs = ["[]", "()", "8<"] for i in range(n): s1 = figs.index(a[i * 2: (i + 1) * 2]) s2 = figs.index(b[i * 2: (i + 1) * 2]) if s2 == (s1 + 1) % 3: x += 1 if s1 == (s2 + 1) % 3: x -= 1 if x > 0: print("TEAM 1 WINS") elif x < 0: print("TEAM 2 WINS") else: print("TIE")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char str[100], str1[100]; int main() { int i, ans1 = 0, ans2 = 0, a, b; scanf("%s", str); scanf("%s", str1); int l = strlen(str); for (i = 0; i < l; i += 2) { if (str[i] == '8') a = 1; if (str[i] == '[') a = 2; if (str[i] == '(') a = 3; if (str1[i] == '8') b = 1; if (str1[i] == '[') b = 2; if (str1[i] == '(') b = 3; if (a == b) continue; if (a == 1) { if (b == 3) ans2++; else ans1++; } if (a == 2) { if (b == 3) ans1++; else ans2++; } if (a == 3) { if (b == 1) ans1++; else ans2++; } } if (ans1 > ans2) printf("TEAM 1 WINS\n"); else if (ans1 < ans2) printf("TEAM 2 WINS\n"); else printf("TIE\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; template <typename T> void printContainer(T& a, int n = -1) { if (n == -1) n = a.size(); cout << "{"; int i = 0; for (auto it : a) { cout << (it) << ", "; if (++i == n) break; } cout << "}\n"; } int main() { string s[2]; cin >> s[0] >> s[1]; int typ[2]; int score = 0; int c = 0; for (int p = 0; p < s[0].size(); p += 2) { for (int i = 0; i < (int)(2); ++i) { int r = 2; if (s[i][p] == '[') r = 0; else if (s[i][p] == '(') r = 1; typ[i] = r; } if (typ[0] == typ[1]) continue; for (int i = 0; i < (int)(3); ++i) if (((typ[0] + 1) % 3) == typ[1]) { ++score; goto final; } --score; final: ++c; } if (score == 0) { cout << "TIE" << endl; } else { cout << (score > 0 ? "TEAM 1 WINS" : "TEAM 2 WINS") << endl; ; } }
7
CPP
#include <bits/stdc++.h> using namespace std; int sum1 = 0, sum2 = 0; string s, s1; void komand() { for (int i = 0; i < s.length(); i += 2) { if (((s[i] == '[' && s1[i] == '(') || (s[i] == '(' && s1[i] == '8')) || (s[i] == '8' && s1[i] == '[')) sum1++; else if (s[i] != s1[i]) sum2++; } } int main() { cin >> s >> s1; komand(); if (sum1 > sum2) cout << "TEAM 1 WINS"; else if (sum1 < sum2) cout << "TEAM 2 WINS"; else cout << "TIE"; }
7
CPP
#include <bits/stdc++.h> int n, ans; char a[10005], b[10005]; int chg(char x) { return x == '[' ? 2 : x == '(' ? 1 : 0; } int work(char *a, char *b) { int x = chg(*a), y = chg(*b); if (x == y) return 0; if ((x + 1) % 3 == y) return -1; return 1; } int main() { scanf("%s%s", a, b), n = strlen(a); for (int i = 0; i < n / 2; ++i) ans += work(a + i * 2, b + i * 2); puts(ans > 0 ? "TEAM 1 WINS" : ans < 0 ? "TEAM 2 WINS" : "TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> char a[100], b[100]; int ans1, ans2; int main() { scanf("%s%s", a, b); for (int i = 0; i < 100; i += 2) { if (a[i] == '8' && b[i] == '(') ans2++; if (a[i] == '8' && b[i] == '[') ans1++; if (a[i] == '(' && b[i] == '8') ans1++; if (a[i] == '(' && b[i] == '[') ans2++; if (a[i] == '[' && b[i] == '8') ans2++; if (a[i] == '[' && b[i] == '(') ans1++; } if (ans1 > ans2) puts("TEAM 1 WINS"); if (ans1 < ans2) puts("TEAM 2 WINS"); if (ans1 == ans2) puts("TIE"); }
7
CPP
a = input()[::2] b = input()[::2] s = 0 for i in range(len(a)): if (a[i]=='8' and b[i]=='[') or (a[i]=='[' and b[i]=='(') or (a[i]=='(' and b[i]=='8'): s+=1 elif (a[i]=='8' and b[i]=='(') or (a[i]=='[' and b[i]=='8') or (a[i]=='(' and b[i]=='['): s-=1 print('TEAM 1 WINS' if s>0 else 'TIE' if s==0 else 'TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; int x = 0; for (int i = 0; i < a.size(); i += 2) { if (a[i] == b[i]) continue; if (a[i] == '8') { if (b[i] == '(') { x--; } else { x++; } } else if (a[i] == '(') { if (b[i] == '[') { x--; } else { x++; } } else { if (b[i] == '(') x++; else x--; } } cout << (!x ? "TIE\n" : (x > 0 ? "TEAM 1 WINS\n" : "TEAM 2 WINS\n")); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; int cnt1 = 0, cnt2 = 0; for (int i = 0; i < s1.size(); i += 2) { int tm1, tm2; switch (s1[i]) { case '(': tm1 = 0; break; case '[': tm1 = 1; break; case '8': tm1 = 2; break; } switch (s2[i]) { case '(': tm2 = 0; break; case '[': tm2 = 1; break; case '8': tm2 = 2; break; } if (tm1 != tm2) { if ((tm1 + 1) % 3 == tm2) cnt2++; else cnt1++; } } if (cnt1 > cnt2) puts("TEAM 1 WINS"); else if (cnt1 < cnt2) puts("TEAM 2 WINS"); else puts("TIE"); }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1; cin >> s2; int l = s1.length(); int a1[20], a2[20]; memset(a1, -1, sizeof(a1)); memset(a1, -1, sizeof(a2)); for (int i = 0; i < l; i += 2) { if (s1[i] == '[') a1[i / 2] = 0; if (s1[i] == '8') a1[i / 2] = 1; if (s1[i] == '(') a1[i / 2] = 2; if (s2[i] == '[') a2[i / 2] = 0; if (s2[i] == '8') a2[i / 2] = 1; if (s2[i] == '(') a2[i / 2] = 2; } int dem = 0; for (int i = 0; i < l / 2; i++) { if (abs(a1[i] - a2[i] + 3) % 3 == 1) dem++; if (abs(a1[i] - a2[i] + 3) % 3 == 2) dem--; } if (dem == 0) cout << "TIE"; if (dem > 0) cout << "TEAM 1 WINS"; if (dem < 0) cout << "TEAM 2 WINS"; }
7
CPP
#include <bits/stdc++.h> const int N = 105; char s1[N], s2[N]; int main() { scanf("%s", s1); scanf("%s", s2); int s = 0; for (int i = 0; s1[i]; i += 2) if (s1[i] == s2[i]) continue; else if (s1[i] < s2[i]) if (s1[i] + s2[i] != 131) s++; else s--; else if (s1[i] + s2[i] != 131) s--; else s++; if (!s) puts("TIE"); else if (s > 0) puts("TEAM 1 WINS"); else puts("TEAM 2 WINS"); }
7
CPP
def split_by_n( seq, n ): while seq: yield seq[:n] seq = seq[n:] def is_first_win(first, second): if first ==second: return 0 if first == '8<': if second == '[]': return 1 else: return -1 if first == '[]': if second == '()': return 1 else: return -1 if second == '8<': return 1 else: return -1 team1 = list(split_by_n(input(), 2)) team2 = list(split_by_n(input(), 2)) score = 0 for i in range(len(team1)): score += is_first_win(team1[i], team2[i]) #print(is_first_win(team1[i], team2[i]), team1[i], team2[i]) #print(score) if score > 0: print('TEAM 1 WINS') elif score == 0: print('TIE') else: print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const int base = 1000 * 1000 * 1000; const int N = 100100; const unsigned long long nf = 1e18; const double pi = 3.1415926535897932384626433832795; const int MAXN = 22; char a[MAXN], b[MAXN]; int main() { scanf("%s%s", a, b); int t = 0; for (int i = 0; a[i]; i += 2) { if (b[i] == '8' && a[i] == '[' || b[i] == '[' && a[i] == '(' || b[i] == '(' && a[i] == '8') ++t; if (a[i] == '8' && b[i] == '[' || a[i] == '[' && b[i] == '(' || a[i] == '(' && b[i] == '8') --t; } puts(t > 0 ? "TEAM 2 WINS" : t == 0 ? "TIE" : "TEAM 1 WINS"); return 0; }
7
CPP
#include <bits/stdc++.h> char s1[2000]; char s2[2000]; int main() { scanf("%s%s", s1, s2); int i = 0; int t1; int t2; int c1 = 0; int c2 = 0; while (s1[i]) { if (s1[i] == '8' && s1[i + 1] == '<') t1 = 0; if (s1[i] == '[' && s1[i + 1] == ']') t1 = 1; if (s1[i] == '(' && s1[i + 1] == ')') t1 = 2; if (s2[i] == '8' && s2[i + 1] == '<') t2 = 0; if (s2[i] == '[' && s2[i + 1] == ']') t2 = 1; if (s2[i] == '(' && s2[i + 1] == ')') t2 = 2; i += 2; if (t1 == t2) continue; if (t1 == 0 && t2 == 1) c1++; if (t1 == 0 && t2 == 2) c2++; if (t1 == 1 && t2 == 0) c2++; if (t1 == 1 && t2 == 2) c1++; if (t1 == 2 && t2 == 0) c1++; if (t1 == 2 && t2 == 1) c2++; } if (c1 > c2) printf("TEAM 1 WINS\n"); else if (c2 > c1) printf("TEAM 2 WINS\n"); else printf("TIE\n"); }
7
CPP
#include <bits/stdc++.h> using namespace std; int main(void) { string str1, str2; while (cin >> str1 >> str2) { int ct1 = 0; int ct2 = 0; for (int i = 0; i < str1.size(); i += 2) { if (str1[i] == str2[i]) continue; else if (str1[i] == '8') { if (str2[i] == '(') { ct1++; } else ct2++; } else if (str1[i] == '(') { if (str2[i] == '8') { ct2++; } else ct1++; } else if (str1[i] == '[') { if (str2[i] == '8') { ct1++; } else ct2++; } } if (ct1 == ct2) cout << "TIE" << endl; else if (ct1 > ct2) cout << "TEAM 2 WINS" << endl; else cout << "TEAM 1 WINS" << endl; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int play(char x) { if (x == '8') return 0; if (x == '[') return 1; return 2; } int main() { string a, b; cin >> a >> b; int n = a.size(); int score = 0; for (int i = 0; i < n; i += 2) { int pa = play(a[i]), pb = play(b[i]); if (pb == (pa + 1) % 3) score++; if (pa == (pb + 1) % 3) score--; } if (score > 0) cout << "TEAM 1 WINS" << endl; else if (score == 0) cout << "TIE" << endl; else cout << "TEAM 2 WINS" << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; string a, b; int x, y; int main() { getline(cin, a); getline(cin, b); for (int i = 0; i < a.length(); i += 2) { if (a[i] == '8') { if (b[i] == '8') { x++; y++; } else if (b[i] == '(') { y++; } else if (b[i] == '[') { x++; } } else if (a[i] == '(') { if (b[i] == '8') { x++; } else if (b[i] == '(') { x++; y++; } else if (b[i] == '[') { y++; } } else if (a[i] == '[') { if (b[i] == '8') { y++; } else if (b[i] == '(') { x++; } else if (b[i] == '[') { y++; x++; } } } if (x > y) { cout << "TEAM 1 WINS"; } else if (y > x) { cout << "TEAM 2 WINS"; } else { cout << "TIE"; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int m, n, i; string a, s; int main() { cin >> a >> s; for (i = 0; i < a.size(); i += 2) { if (a[i] == '[') { if (s[i] == '8') { n++; } if (s[i] == '(') { m++; } } if (a[i] == '(') { if (s[i] == '[') { n++; } if (s[i] == '8') { m++; } } if (a[i] == '8') { if (s[i] == '[') { m++; } if (s[i] == '(') { n++; } } } if (m > n) { cout << "TEAM 1 WINS"; } if (n > m) { cout << "TEAM 2 WINS"; } if (m == n) { cout << "TIE"; } return 0; }
7
CPP
s=input() p=input() n=len(s) ans=0 for i in range(0,n,2): if s[i:i+2]=='8<': if p[i:i+2]=='[]': ans+=1 elif p[i:i+2]=='()': ans-=1 if s[i:i+2]=='[]': if p[i:i+2]=='()': ans+=1 elif p[i:i+2]=='8<': ans-=1 if s[i:i+2]=='()': if p[i:i+2]=='8<': ans+=1 elif p[i:i+2]=='[]': ans-=1 if ans<0: print('TEAM 2 WINS') elif ans==0: print('TIE') else: print('TEAM 1 WINS')
7
PYTHON3
#include <bits/stdc++.h> char a[22], b[22]; int score(char *a, char *b) { int rst = 0; for (int i = 0; a[i]; i += 2) if (a[i] == '8') { if (b[i] == '[') rst++; else if (b[i] == '(') rst--; } else if (a[i] == '[') { if (b[i] == '(') rst++; else if (b[i] == '8') rst--; } else { if (b[i] == '8') rst++; else if (b[i] == '[') rst--; } return rst; } int main() { scanf("%s %s", &a, &b); int t = score(a, b); if (t < 0) printf("TEAM 2 WINS\n"); else if (t > 0) printf("TEAM 1 WINS\n"); else printf("TIE\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int k1, k2; int main() { string s1, s2; cin >> s1 >> s2; for (int i = 0; i < s1.size(); i += 2) if (s1[i] != s2[i]) { if (s1[i] == '[' && s2[i] == '8') k2++; if (s1[i] == '[' && s2[i] == '(') k1++; if (s1[i] == '(' && s2[i] == '8') k1++; if (s1[i] == '(' && s2[i] == '[') k2++; if (s1[i] == '8' && s2[i] == '[') k1++; if (s1[i] == '8' && s2[i] == '(') k2++; } if (k1 > k2) cout << "TEAM 1 WINS"; if (k1 == k2) cout << "TIE"; if (k1 < k2) cout << "TEAM 2 WINS"; }
7
CPP
#include <bits/stdc++.h> using namespace std; char team1[21], team2[21]; int sum_1, sum_2; int comb(char arr[21], int i) { if ((arr[i] == '(') && (arr[i + 1] == ')')) return 1; else if (arr[i] == '[' && arr[i + 1] == ']') return 2; else if (arr[i] == '8' && arr[i + 1] == '<') return 3; return 1; } void points(void) { for (int i = 0; i < (int)strlen(team1); i += 2) { int comb_1 = comb(team1, i); int comb_2 = comb(team2, i); if (comb_1 != comb_2) { if ((comb_1 == 2 && comb_2 == 1) || (comb_1 == 1 && comb_2 == 3) || (comb_1 == 3 && comb_2 == 2)) ++sum_1; else ++sum_2; } } } int main() { scanf("%s\n%s", team1, team2); points(); if (sum_1 > sum_2) printf("%s\n", "TEAM 1 WINS"); else if (sum_1 < sum_2) printf("%s\n", "TEAM 2 WINS"); else printf("%s\n", "TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string a; string b; int i, n, ja, jb, p1, p2; cin >> a >> b; n = a.length(); p1 = p2 = 0; for (i = 0; i < n; i += 2) { if (a[i] == '8') ja = 0; if (a[i] == '[') ja = 1; if (a[i] == '(') ja = 2; if (b[i] == '8') jb = 0; if (b[i] == '[') jb = 1; if (b[i] == '(') jb = 2; if (ja == 0) { if (jb == 1) p1++; if (jb == 2) p2++; } if (ja == 1) { if (jb == 2) p1++; if (jb == 0) p2++; } if (ja == 2) { if (jb == 0) p1++; if (jb == 1) p2++; } } if (p1 > p2) cout << "TEAM 1 WINS\n"; if (p1 == p2) cout << "TIE\n"; if (p1 < p2) cout << "TEAM 2 WINS\n"; }
7
CPP
#include <bits/stdc++.h> char s1[1111], s2[1111]; int main() { while (scanf("%s %s", &s1, &s2) != EOF) { int len = strlen(s1), a = 0; for (int i = 0; i < len; i += 2) { if (s1[i] == '8') { if (s2[i] == '[') a++; else if (s2[i] == '(') a--; } else if (s1[i] == '[') { if (s2[i] == '(') a++; else if (s2[i] == '8') a--; } else if (s1[i] == '(') { if (s2[i] == '8') a++; else if (s2[i] == '[') a--; } } if (a > 0) printf("TEAM 1 WINS\n"); else if (a < 0) printf("TEAM 2 WINS\n"); else printf("TIE\n"); } return 0; }
7
CPP
a = input() b = input() d = [[0, 1, -1], [-1, 0, 1], [1, -1, 0]] m = {"()":0, "8<":1, "[]":2} s = sum(d[m[a[i:i + 2]]][m[b[i:i + 2]]] for i in range(0, len(a), 2)) print("TEAM 1 WINS" if s > 0 else "TEAM 2 WINS" if s < 0 else "TIE")
7
PYTHON3
#include <bits/stdc++.h> int main() { char a[10000], b[10000]; int l, i, j, k; k = j = 0; gets(a); gets(b); l = strlen(a); for (i = 0; i < l; i += 2) { if ((a[i] == '8' && b[i] == '[') || (a[i] == '[' && b[i] == '(') || (a[i] == '(' && b[i] == '8')) j++; else if ((a[i] == '[' && b[i] == '8') || (a[i] == '(' && b[i] == '[') || (a[i] == '8' && b[i] == '(')) k++; } if (j > k) puts("TEAM 1 WINS"); else if (j < k) puts("TEAM 2 WINS"); else puts("TIE"); }
7
CPP
w = { "8<":"[]", "[]":"()", "()":"8<" } a,b = input(), input() p = 0 for i in range(0, len(a), 2): r,s = a[i:i+2],b[i:i+2] if(w[r]==s): p+=1 elif(w[s]==r): p-=1 if p==0: print("TIE") elif p<0: print("TEAM 2 WINS") else: print("TEAM 1 WINS")
7
PYTHON3
a, b = input()[:: 2], input()[:: 2] s, t = 0, ['8[', '[(', '(8'] for i, j in zip(a, b): if i == j: continue if i + j in t: s += 1 else: s -= 1 if s: print('TEAM', 1 + (s < 0), 'WINS') else: print('TIE')
7
PYTHON3
rps = { "[]": 0, "8<": 1, "()": 2 } s = input() t = input() n = len(s)//2 score = 0 for i in range(n): res = (rps[s[2*i:2*i+2]] - rps[t[2*i:2*i+2]] + 1) % 3 - 1 score += res if score > 0: print("TEAM 1 WINS") elif score < 0: print("TEAM 2 WINS") else: print("TIE")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; string a, b; long long pA = 0, pB = 0; cin >> a >> b; string subA, subB; long long tA, tB; for (long long i = 0; i < a.size() / 2; i++) { subA = a.substr(i * 2, 2); subB = b.substr(i * 2, 2); tA = (subA == "[]") ? 1 : (subA == "()") ? 2 : 3; tB = (subB == "[]") ? 1 : (subB == "()") ? 2 : 3; if (tA == tB) continue; if (tA == 1) { if (tB == 2) pA++; else pB++; } else if (tA == 2) { if (tB == 1) pB++; else pA++; } else { if (tB == 1) pA++; else pB++; } } if (pA > pB) cout << "TEAM 1 WINS"; else if (pA < pB) cout << "TEAM 2 WINS"; else cout << "TIE"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char s1[25], s2[25]; while (cin >> s1 >> s2) { int res = 0; for (int i = 0; s1[i] != '\0'; i += 2) { if (s1[i] != s2[i]) { if ((s1[i] == '8' && s2[i] == '[') || (s1[i] == '[' && s2[i] == '(') || (s1[i] == '(' && s2[i] == '8')) res++; else res--; } } if (res > 0) cout << "TEAM 1 WINS" << endl; else if (res < 0) cout << "TEAM 2 WINS" << endl; else cout << "TIE" << endl; } return 0; }
7
CPP
s = input() t = input() n = len(s) d = {'([': [0, 1], '((': [0, 0], '[[': [0, 0], '88': [0, 0], '(8': [1, 0], '8(': [0, 1], '[8': [0, 1], '8[': [1, 0], '[(': [1, 0]} p, q = 0, 0 for i in range(0, n, 2): p += d[s[i] + t[i]][0] q += d[s[i] + t[i]][1] if p == q: print('TIE') elif p > q: print('TEAM 1 WINS') else: print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char str1[100001], str2[100001]; int len, ans = 0, get1, get2; int getsum(char ch) { if (ch == '8') return 3; if (ch == '[') return 2; if (ch == '(') return 1; } int main() { scanf("%s", str1); scanf("%s", str2); len = strlen(str1); for (int i = 0; i < len; i += 2) { if (str1[i] == str2[i]) continue; get1 = getsum(str1[i]), get2 = getsum(str2[i]); if (get1 > get2) ans++; else if (get1 < get2) ans--; if (get1 == 1 && get2 == 3) ans += 2; if (get1 == 3 && get2 == 1) ans -= 2; } if (ans > 0) printf("TEAM 1 WINS\n"); else if (ans == 0) printf("TIE\n"); else printf("TEAM 2 WINS\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; int x = 0, y = 0, n; n = a.size(); for (int i = 0; i < n; i += 2) { if (a[i] == b[i]) continue; if ((a[i] == '[' && b[i] == '8') || (a[i] == '8' && b[i] == '(') || (a[i] == '(' && b[i] == '[')) y++; else x++; } if (x > y) cout << "TEAM 1 WINS"; else if (y > x) cout << "TEAM 2 WINS"; else cout << "TIE"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; bool wins(char a, char b) { if (a == '8' && b == '[') return true; if (a == '[' && b == '(') return true; if (a == '(' && b == '8') return true; return false; } int main() { string s1, s2; cin >> s1 >> s2; int n1 = 0; int n2 = 0; for (int i = 0; i < s1.size(); i += 2) { if (s1[i] == s2[i]) continue; if (wins(s1[i], s2[i])) n1++; else n2++; } if (n1 > n2) cout << "TEAM 1 WINS" << '\n'; else if (n1 < n2) cout << "TEAM 2 WINS" << '\n'; else cout << "TIE" << '\n'; }
7
CPP
#include <bits/stdc++.h> using namespace std; char s[33], c[33]; int n, S = 0; int main() { cin >> s >> c; n = strlen(s); for (int i = 0; i < n; i += 2) if ((s[i] == '[' && c[i] == '(') || (s[i] == '(' && c[i] == '8') || (s[i] == '8' && c[i] == '[')) S++; else if ((c[i] == '[' && s[i] == '(') || (c[i] == '(' && s[i] == '8') || (c[i] == '8' && s[i] == '[')) S--; if (S > 0) cout << "TEAM 1 WINS"; if (S < 0) cout << "TEAM 2 WINS"; if (!S) cout << "TIE"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int A, B; string a, b; void f(int x) { if (a[x] == '[') { if (b[x] == '8') B++; if (b[x] == '(') A++; } if (a[x] == '8') { if (b[x] == '[') A++; if (b[x] == '(') B++; } if (a[x] == '(') { if (b[x] == '[') B++; if (b[x] == '8') A++; } } int main() { cin >> a >> b; for (int i = 0; i < a.size(); i += 2) f(i); printf("%s", A > B ? "TEAM 1 WINS" : A == B ? "TIE" : "TEAM 2 WINS"); }
7
CPP
def get(c): return "8[(".index(c) def win(d, e): return (get(d) + 1) % 3 == get(e) a = input() b = input() x = 0 y = 0 for i in range(0, len(a), 2): x += win(a[i], b[i]) y += win(b[i], a[i]) if x > y: print('TEAM 1 WINS') elif x < y: print('TEAM 2 WINS') else: print('TIE')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; struct point { float x, y; }; int main() { char a[20], b[20]; cin >> a >> b; int q1 = 0, q2 = 0; for (int i = 0; a[2 * i] != '\0'; i++) { if ((a[2 * i] == '8' && b[2 * i] == '[') || (a[2 * i] == '[' && b[2 * i] == '(') || (a[2 * i] == '(' && b[2 * i] == '8')) q1++; else if ((b[2 * i] == '8' && a[2 * i] == '[') || (b[2 * i] == '[' && a[2 * i] == '(') || (b[2 * i] == '(' && a[2 * i] == '8')) q2++; } if (q1 == q2) cout << "TIE"; else if (q1 > q2) cout << "TEAM 1 WINS"; else if (q2 > q1) cout << "TEAM 2 WINS"; return 0; }
7
CPP
a = input().strip() b = input().strip() n = len(a) // 2 c1 = 0 c2 = 0 for i in range(n): s = i * 2 a1 = a[s:s + 2] b1 = b[s:s + 2] if a1 == b1: continue if a1 == '[]': if b1 == '8<': c2 += 1 elif b1 == '()': c1 += 1 elif a1 == '()': if b1 == '[]': c2 += 1 elif b1 == '8<': c1 += 1 else: if b1 == '[]': c1 += 1 elif b1 == '()': c2 += 1 if c2 > c1: print("TEAM 2 WINS") elif c2==c1: print("TIE") else: print("TEAM 1 WINS")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long int Maxn3 = 1e3 + 10; const long long int Maxn4 = 1e4 + 10; const long long int Maxn5 = 1e5 + 10; const long long int Maxn6 = 1e6 + 10; const long long int Maxn7 = 1e7 + 10; const long long int Maxn8 = 1e8 + 10; const long long int Maxn9 = 1e9 + 10; const long long int Maxn18 = 1e18 + 10; const long long int Mod1 = 1e7 + 7; const long long int Mod2 = 1e9 + 7; const long long int LLMax = LLONG_MAX; const long long int LLMin = LLONG_MIN; const long long int INTMax = INT_MAX; const long long int INTMin = INT_MIN; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); string a, b; cin >> a >> b; long long int x = 0, y = 0, s = a.size(); for (long long int i = 0; i < s; i += 2) if ((a[i] == '[' and b[i] == '(') || (a[i] == '8' and b[i] == '[') || (a[i] == '(' and b[i] == '8')) x++; else if ((a[i] == '[' and b[i] == '8') || (a[i] == '8' and b[i] == '(') || (a[i] == '(' and b[i] == '[')) y++; if (x > y) return cout << "TEAM 1 WINS", 0; else if (y > x) return cout << "TEAM 2 WINS", 0; return cout << "TIE", 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int ok(char x, char y) { if (x == y) return 0; else if ((x == '8' && y == '[') || (x == '[' && y == '(') || (x == '(' && y == '8')) return 1; return -1; } int main() { char a[250], b[250]; cin >> a >> b; int i = 0, one = 0, two = 0; while (a[i]) { if (ok(a[i], b[i]) == 1) one++; else if (ok(a[i], b[i]) == -1) two++; i += 2; } if (one > two) cout << "TEAM 1 WINS" << endl; else if (two > one) cout << "TEAM 2 WINS" << endl; else cout << "TIE" << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; char s1[25], s2[25]; int z[256][256]; int main() { scanf("%s%s", s1, s2); int S1 = 0, S2 = 0; z['[']['8'] = 1; z['(']['['] = 1; z['8']['('] = 1; for (int i = 0; s1[i] != 0; i += 2) { if (z[s1[i]][s2[i]]) S1++; if (z[s2[i]][s1[i]]) S2++; } if (S1 > S2) printf("TEAM 2 WINS\n"); else if (S1 == S2) printf("TIE\n"); else printf("TEAM 1 WINS\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a; cin >> b; int p1 = 0; int p2 = 0; for (int i = 0; i < a.size(); i += 2) { string player1 = a.substr(i, 2); string player2 = b.substr(i, 2); if (player1 == "[]") { if (player2 == "8<") p2++; else if (player2 == "()") p1++; } else if (player1 == "8<") { if (player2 == "[]") p1++; else if (player2 == "()") p2++; } else if (player1 == "()") { if (player2 == "8<") p1++; else if (player2 == "[]") p2++; } } if (p1 > p2) { cout << "TEAM 1 WINS"; } else if (p2 > p1) cout << "TEAM 2 WINS"; else cout << "TIE"; }
7
CPP
t=0 a,b,c=input(),input(),'8([' for i in range(0,len(a),2): k=c.index(a[i]) t+=1 if b[i]==c[k-1]else 0 if b[i]==c[k]else -1 print("TEAM %d WINS"%(1 if t>0 else 2)if t else "TIE")
7
PYTHON3
__author__ = 'Nova' # import sys # sys.stdin = open('input.txt', 'r') def parse_string(s): ret = [] m = len(s) // 2; for i in range(m): ss = ''.join(s[i * 2:i * 2 + 2]) if ss == '8<': ret.append(0) elif ss == '[]': ret.append(1) elif ss == '()': ret.append(2) return ret s1, s2 = input(), input() l1, l2 = parse_string(s1), parse_string(s2) res = 0 mapo = {(0, 1): 1, (1, 2): 1, (2, 0): 1, (1, 0): -1, (2, 1): -1, (0, 2): -1} for i in range(len(l1)): if l1[i] != l2[i]: res += mapo[(l1[i], l2[i])] if res == 0: print('TIE') elif res > 0: print('TEAM 1 WINS') else: print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; int team1 = 0, team2 = 0; cin >> s1 >> s2; for (int i = 0; i < s1.size(), i < s2.size(); i++) { if (s1[i] == '[') { if (s2[i] == '(') team1++; else if (s2[i] == '8') team2++; } else if (s1[i] == '(') { if (s2[i] == '[') team2++; else if (s2[i] == '8') team1++; } else if (s1[i] == '8') { if (s2[i] == '[') team1++; else if (s2[i] == '(') team2++; } } if (team1 > team2) cout << "TEAM 1 WINS" << endl; else if (team2 > team1) cout << "TEAM 2 WINS" << endl; else cout << "TIE" << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; string s1, s2; int main() { cin >> s1 >> s2; int k1 = 0, k2 = 0; for (int i = 0; i < s1.length(); i += 2) if ((s1[i] == '(' && s2[i] == '8') || (s1[i] == '[' && s2[i] == '(') || (s1[i] == '8' && s2[i] == '[')) { k1++; } else if ((s2[i] == '(' && s1[i] == '8') || (s2[i] == '[' && s1[i] == '(') || (s2[i] == '8' && s1[i] == '[')) { k2++; } else { k1++; k2++; } if (k1 > k2) cout << "TEAM 1 WINS"; else if (k1 < k2) cout << "TEAM 2 WINS"; else cout << "TIE"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; char s1[205], s2[205]; int Check(int x, int y) { if ((x == 1 && y == 2) || (x == 2 && y == 3) || (x == 3 && y == 1)) return 1; if ((y == 1 && x == 2) || (y == 2 && x == 3) || (y == 3 && x == 1)) return -1; return 0; } int main() { scanf("%s", s1 + 1); scanf("%s", s2 + 1); int len = strlen(s1 + 1); int ans1 = 0, ans2 = 0; for (int i = 1; i <= len; i += 2) { int flag1, flag2; if (s1[i] == '[') flag1 = 1; if (s1[i] == '(') flag1 = 2; if (s1[i] == '8') flag1 = 3; if (s2[i] == '[') flag2 = 1; if (s2[i] == '(') flag2 = 2; if (s2[i] == '8') flag2 = 3; if (Check(flag1, flag2) == 1) ans1++; else if (Check(flag1, flag2) == -1) ans2++; } if (ans1 > ans2) printf("TEAM 1 WINS\n"); else if (ans1 < ans2) printf("TEAM 2 WINS\n"); else printf("TIE\n"); }
7
CPP
#include <bits/stdc++.h> char a[30], b[30]; int main() { int i, xa = 0, xb = 0; gets(a); gets(b); for (i = 0; i < strlen(a); i += 2) { if ((a[i] == '8' && b[i] == '[') || (a[i] == '[' && b[i] == '(') || (a[i] == '(' && b[i] == '8')) xa++; if ((b[i] == '8' && a[i] == '[') || (b[i] == '[' && a[i] == '(') || (b[i] == '(' && a[i] == '8')) xb++; } if (xa > xb) puts("TEAM 1 WINS"); else if (xa < xb) puts("TEAM 2 WINS"); else puts("TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> int FASTBUFFER; using namespace std; char s1[1005], s2[1005]; int a[4][4]; int main() { scanf("%s", s1 + 1); scanf("%s", s2 + 1); int w1 = 0, w2 = 0; a[1][3] = a[2][1] = a[3][2] = 1; for (int i = 1; s1[i]; i += 2) { int x1, x2; if (s1[i] == '8') x1 = 1; else if (s1[i] == '[') x1 = 3; else x1 = 2; if (s2[i] == '8') x2 = 1; else if (s2[i] == '[') x2 = 3; else x2 = 2; w1 += a[x1][x2]; w2 += a[x2][x1]; } if (w1 == w2) printf("TIE\n"); else if (w1 > w2) printf("TEAM 1 WINS\n"); else printf("TEAM 2 WINS\n"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n1 = 0, n2 = 0; string x, y, temp1, temp2; cin >> x >> y; for (int i = 0; i < x.size(); i += 2) { temp1 = x.substr(i, 2); temp2 = y.substr(i, 2); if (temp1 == "[]" && temp2 == "()") n1++; else if (temp1 == "()" && temp2 == "8<") n1++; else if (temp1 == "8<" && temp2 == "[]") n1++; else if (temp2 == "[]" && temp1 == "()") n2++; else if (temp2 == "()" && temp1 == "8<") n2++; else if (temp2 == "8<" && temp1 == "[]") n2++; } if (n1 > n2) cout << "TEAM 1 WINS"; else if (n2 > n1) cout << "TEAM 2 WINS"; else cout << "TIE"; }
7
CPP
rock="[]" paper="()" scissor="8<" team1=str(input()) team2=str(input()) team11=0 team22=0 i=0 while i<len(team1): if(team1[i]+team1[i+1]==team2[i]+team2[i+1]): i+=2 continue elif(team1[i]+team1[i+1]=="[]" and team2[i]+team2[i+1]=="8<"): team11+=1 elif(team1[i]+team1[i+1]=="()" and team2[i]+team2[i+1]=="[]"): team11+=1 elif(team1[i]+team1[i+1]=="8<" and team2[i]+team2[i+1]=="()"): team11+=1 else: team22+=1 i+=2 if(team11<team22):print("TEAM 1 WINS") elif(team22<team11):print("TEAM 2 WINS") else:print("TIE")
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const double eps = 1e-12; const int MAXN = 1005; const int MAXM = 5005; char p1[40], p2[40]; int main() { while (~scanf("%s%s", p1, p2)) { int a = 0, b = 0, len = strlen(p1); for (int i = 0; i < len; i += 2) { if (p1[i] == '8' && p2[i] == '[' || p1[i] == '[' && p2[i] == '(' || p1[i] == '(' && p2[i] == '8') a++; else if (p2[i] == '8' && p1[i] == '[' || p2[i] == '[' && p1[i] == '(' || p2[i] == '(' && p1[i] == '8') b++; } printf("%s\n", a > b ? "TEAM 1 WINS" : (a == b ? "TIE" : "TEAM 2 WINS")); } return 0; }
7
CPP
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i+n] stone = '[]' scissors = '8<' paper = '()' def compare_r1_to_r2(r1, r2): if r1 == r2: return None elif r1 == stone and r2 == scissors or \ r1 == paper and r2 == stone or \ r1 == scissors and r2 == paper: return True else: return False FT = input() ST = input() FT = list(chunks(FT, 2)) ST = list(chunks(ST, 2)) SFT, SST = 0, 0 for i in range(0, len(FT)): result = compare_r1_to_r2(FT[i], ST[i]) if result: SST += 1 elif result is not None: SFT += 1 if SFT > SST: print('TEAM 1 WINS') elif SFT < SST: print('TEAM 2 WINS') else: print('TIE')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; inline void OPEN(const string &s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int main() { string a, b; cin >> a >> b; int n = a.length() / 2; int na = 0, nb = 0; for (int i = 0; i < (n); ++i) { int actiona, actionb; if (a[2 * i] == '[' && a[2 * i + 1] == ']') { actiona = 3; } if (a[2 * i] == '(' && a[2 * i + 1] == ')') { actiona = 1; } if (a[2 * i] == '8' && a[2 * i + 1] == '<') { actiona = 2; } if (b[2 * i] == '[' && b[2 * i + 1] == ']') { actionb = 3; } if (b[2 * i] == '(' && b[2 * i + 1] == ')') { actionb = 1; } if (b[2 * i] == '8' && b[2 * i + 1] == '<') { actionb = 2; } if ((actiona == 1 && actionb == 2) || (actiona == 2 && actionb == 3) || (actiona == 3 && actionb == 1)) { na++; } else if ((actionb == 1 && actiona == 2) || (actionb == 2 && actiona == 3) || (actionb == 3 && actiona == 1)) { nb++; } } if (na > nb) puts("TEAM 1 WINS"); if (na < nb) puts("TEAM 2 WINS"); if (na == nb) puts("TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { char a1[21], a2[21]; int n1 = 0, n2 = 0, i; cin >> a1; cin >> a2; for (i = 0; a1[i] != '\0'; i = i + 2) { if (a1[i] == '[' && a2[i] == '8' || a1[i] == '(' && a2[i] == '[' || a1[i] == '8' && a2[i] == '(') n2++; if (a2[i] == '[' && a1[i] == '8' || a2[i] == '(' && a1[i] == '[' || a2[i] == '8' && a1[i] == '(') n1++; } if (n1 > n2) cout << "TEAM 1 WINS" << endl; else if (n1 < n2) cout << "TEAM 2 WINS" << endl; else cout << "TIE"; }
7
CPP
#include <bits/stdc++.h> int main() { char s1[100], s2[100]; int t1, t2, len, i, ans1 = 0, ans2 = 0; scanf("%s%s", s1, s2); len = strlen(s1); for (i = 0; i < len / 2; i++) { if (s1[i * 2] == '8') t1 = 0; if (s1[i * 2] == '(') t1 = 1; if (s1[i * 2] == '[') t1 = 2; if (s2[i * 2] == '8') t2 = 0; if (s2[i * 2] == '(') t2 = 1; if (s2[i * 2] == '[') t2 = 2; if (t1 == t2) continue; if ((t1 == 0 and t2 == 2) or (t1 == 1 and t2 == 0) or (t1 == 2 and t2 == 1)) ans1++; else ans2++; } if (ans1 > ans2) printf("TEAM 1 WINS"); if (ans1 < ans2) printf("TEAM 2 WINS"); if (ans1 == ans2) printf("TIE"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); string team1, team2; cin >> team1 >> team2; int score = 0, move1, move2; for (int i = 0; i < team1.size(); i += 2) { move1 = team1[i] == '(' ? 1 : (team1[i] == '[' ? 2 : 3); ; move2 = team2[i] == '(' ? 1 : (team2[i] == '[' ? 2 : 3); ; if (move1 != move2) { if ((move1 == 2 && move2 == 1) || (move1 == 3 && move2 == 2) || (move1 == 1 && move2 == 3)) ++score; else --score; } } cout << (score > 0 ? "TEAM 1 WINS" : score < 0 ? "TEAM 2 WINS" : "TIE") << '\n'; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { string a, b; while (cin >> a >> b) { int cnt1 = 0, cnt2 = 0; for (int i = 0, j = 0; i < a.length(); i += 2, j += 2) { if (a[i] == '[' && b[i] == '8') cnt2++; else if (b[i] == '[' && a[i] == '8') cnt1++; else if (a[i] == '(' && b[i] == '[') cnt2++; else if (b[i] == '(' && a[i] == '[') cnt1++; else if (a[i] == '(' && b[i] == '8') cnt1++; else if (a[i] == '8' && b[i] == '(') cnt2++; } if (cnt1 > cnt2) cout << "TEAM 1 WINS" << endl; else if (cnt1 == cnt2) cout << "TIE" << endl; else cout << "TEAM 2 WINS" << endl; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int i, wincount1 = 0, wincount2 = 0; char team1[20], team2[20], id1, id2; scanf("%s", team1); scanf("%s", team2); for (i = 0; i < 20; i = i + 2) { if (team1[i] == '(') { id1 = 'r'; } else if (team1[i] == '[') { id1 = 'p'; } else { id1 = 's'; } if (team2[i] == '(') { id2 = 'r'; } else if (team2[i] == '[') { id2 = 'p'; } else { id2 = 's'; } if (id1 == 'r' && id2 == 'p') { wincount2++; } else if (id1 == 'r' && id2 == 's') { wincount1++; } else if (id1 == 'p' && id2 == 'r') { wincount1++; } else if (id1 == 'p' && id2 == 's') { wincount2++; } else if (id1 == 's' && id2 == 'r') { wincount2++; } else if (id1 == 's' && id2 == 'p') { wincount1++; } } if (wincount1 > wincount2) { printf("TEAM 1 WINS\n"); } else if (wincount2 > wincount1) { printf("TEAM 2 WINS\n"); } else { printf("TIE\n"); } return 0; }
7
CPP
#include <bits/stdc++.h> const long double eps = 1e-9; const double pi = acos(-1.0); const long long inf = 1e18; using namespace std; int main(int argc, const char* argv[]) { string a, b; cin >> a >> b; int cnt1 = 0, cnt2 = 0; for (int i = 0; i < a.size(); i += 2) { if (a[i] == b[i]) continue; if (a[i] == '8' && b[i] == '(') cnt2++; if (a[i] == '8' && b[i] == '[') cnt1++; if (a[i] == '(' && b[i] == '[') cnt2++; if (a[i] == '(' && b[i] == '8') cnt1++; if (a[i] == '[' && b[i] == '(') cnt1++; if (a[i] == '[' && b[i] == '8') cnt2++; } if (cnt1 > cnt2) puts("TEAM 1 WINS"); if (cnt1 < cnt2) puts("TEAM 2 WINS"); if (cnt1 == cnt2) puts("TIE"); return 0; }
7
CPP
def res(a, b): if a == '8<' and b == '[]': return 1 elif a == '8<' and b == '()': return -1 elif a == '8<' and b == '8<': return 0 elif a == '[]' and b == '8<': return -1 elif a == '[]' and b == '()': return 1 elif a == '[]' and b == '[]': return 0 elif a == '()' and b == '8<': return 1 elif a == '()' and b == '[]': return -1 elif a == '()' and b == '()': return 0 s1 = input() s2 = input() s1 = [s1[i:i+2] for i in range(0, len(s1), 2)] s2 = [s2[i:i+2] for i in range(0, len(s2), 2)] sum = 0 for i in zip(s1, s2): sum += res(*i) if sum > 0: print('TEAM 1 WINS') elif sum < 0: print('TEAM 2 WINS') else: print('TIE')
7
PYTHON3
s = input() t = input() t1 = 0 t2 = 0 for i in range(0, len(s), 2): q1, q2 = s[i] + s[i + 1], t[i] + t[i + 1] if q1 != q2: if q1 == '8<': if q2 == '()': t2 += 1 else: t1 += 1 elif q1 == '()': if q2 == '[]': t2 += 1 else: t1 += 1 else: if q2 == '8<': t2 += 1 else: t1 += 1 if t1 > t2: print('TEAM 1 WINS') elif t1 == t2: print('TIE') else: print('TEAM 2 WINS')
7
PYTHON3
s1 = input() s2 = input() def identify(figure): if figure == '8<': return 'scissors' elif figure == '[]': return 'paper' else: return 'stone' first, second = 0, 0 i = 0 while i < len(s1)-1: p1 = identify(s1[i:i+2]) p2 = identify(s2[i:i+2]) # print(p1, p2) if p1 == 'scissors': if p2 == 'paper': first += 1 elif p2 == 'stone': second += 1 elif p1 == 'paper': if p2 == 'stone': first += 1 elif p2 == 'scissors': second += 1 elif p1 == 'stone': if p2 == 'scissors': first += 1 elif p2 == 'paper': second += 1 i += 2 if first == second: print('TIE') elif first < second: print('TEAM 2 WINS') else: print('TEAM 1 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char s1[30]; char s2[30]; int main() { scanf("%s", s1); scanf("%s", s2); int a, b; a = 0; b = 0; for (int i = 0; i < strlen(s1); i += 2) { if (s1[i] == '[' && s2[i] == '8') b++; if (s1[i] == '8' && s2[i] == '[') a++; if (s1[i] == '(' && s2[i] == '8') a++; if (s1[i] == '8' && s2[i] == '(') b++; if (s1[i] == '[' && s2[i] == '(') a++; if (s1[i] == '(' && s2[i] == '[') b++; } if (a == b) printf("TIE\n"); else if (a < b) printf("TEAM 2 WINS\n"); else printf("TEAM 1 WINS\n"); return 0; }
7
CPP
a = input() b = input() d = 0 s = 0 for i in range(0, len(a), 2): if a[i] == "[": if b[i] == "(": s = s + 1 elif b[i] == "8": # s=s-1 d = d + 1 else: pass elif a[i] == "(": if b[i] == "[": d = d + 1 elif b[i] == "8": s = s + 1 else: pass elif a[i] == "8": if b[i] == "(": d = d + 1 elif b[i] == "[": s = s + 1 else: pass else: pass if (s>d): print('TEAM 1 WINS') elif s==d: print('TIE') else : print('TEAM 2 WINS')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; string T1, T2; const int biao[3][3] = {{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}; inline int s(string st) { if (st == "8<") return 0; if (st == "()") return 1; if (st == "[]") return 2; return -1; } int main() { ios::sync_with_stdio(false); cin >> T1 >> T2; int x, y, len = T1.size() / 2, s1 = 0, s2 = 0; for (int i = 0; i < len; ++i) { x = s(string(T1.begin() + (i << 1), T1.begin() + ((i + 1) << 1))); y = s(string(T2.begin() + (i << 1), T2.begin() + ((i + 1) << 1))); s1 += biao[x][y]; s2 += biao[y][x]; } if (s1 > s2) cout << "TEAM 1 WINS\n"; else if (s1 < s2) cout << "TEAM 2 WINS\n"; else cout << "TIE\n"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; map<string, int> ha; int main() { char s1[10000], s2[10000]; ha["8<"] = 3; ha["()"] = 1; ha["[]"] = 2; gets(s1); gets(s2); int len = strlen(s1); int a = 0, b = 0; for (int i = 0; i < len; i += 2) { string c = "", d = ""; c += s1[i]; c += s1[i + 1]; d += s2[i]; d += s2[i + 1]; int cc = ha[c]; int dd = ha[d]; if (cc == dd) continue; if (cc - dd == 1 || (cc == 1 && dd == 3)) a++; else b++; } if (a == b) puts("TIE"); else if (a < b) puts("TEAM 2 WINS"); else puts("TEAM 1 WINS"); }
7
CPP
#include <bits/stdc++.h> using namespace std; int Round(double x) { if (x >= 0) return (int)(x + 0.5); else return (int)(x - 0.5); } int main() { string s1, s2; cin >> s1 >> s2; int res = 0; for (int i = 0; i < s1.size(); i += 2) { string a; a += s1[i]; a += s1[i + 1]; string b; b += s2[i]; b += s2[i + 1]; if (a == "[]") { if (b == "()") res++; else if (b == "8<") res--; } else if (a == "()") { if (b == "8<") res++; else if (b == "[]") res--; } else { if (b == "[]") res++; else if (b == "()") res--; } } if (res > 0) cout << "TEAM 1 WINS" << endl; else if (res < 0) cout << "TEAM 2 WINS" << endl; else cout << "TIE" << endl; return 0; }
7
CPP