Untitled
unknown
plain_text
a year ago
2.5 kB
20
Indexable
Never
#include <bits/stdc++.h> using namespace std; bool testing = false; #define F first #define S second #define ll long long #define tc \ int t; \ cin >> t; \ while (t--) #define all(A) A.begin(), A.end() void fio() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); } void file_io(string fname) { freopen((fname + ".in").c_str(), "r", stdin); freopen((fname + ".out").c_str(), "w", stdout); } void file_i(string fname) { freopen((fname + ".in").c_str(), "r", stdin); } void exec_time() { using namespace std::chrono; // Get starting timepoint static auto start = high_resolution_clock::now(); static bool end = false; // Get ending timepoint if (end) { auto stop = high_resolution_clock::now(); // Get duration. Substart timepoints to // get durarion. To cast it to proper unit // use duration cast method auto duration = duration_cast<milliseconds>(stop - start); cout << "\nExec Time :" << duration.count() << " milliseconds\n"; } else end = true; } int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(int a, int b) { return (a / gcd(a, b)) * b; } // ------------------ Global variables declaration --------------------- // // -------------------------------------------------------------------- // vector<int> o; //---------------------------------methods------------------------------------- struct cmp { bool operator()(int a, int b) { return o[a] > o[b]; } }; //---------------------------------methods------------------------------------- int main() { testing = true; fio(); if (testing) { file_io("shell"); exec_time(); } //-------------------------------solution-------------------------------- int n; cin >> n; vector<int> s(3); for (int i = 0; i < 3; i++) { s[i] = i; } vector<int> cw(3); for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; a--, b--, c--; swap(s[a], s[b]); cw[s[c]]++; } cout << max(cw[0], max(cw[1], cw[2])); //----------------------------------------------------------------------- if (testing) exec_time(); return 0; }