|
|
Show all threads Hide all threads Show all messages Hide all messages | Test 1 , WA | alennv | 2020. Traffic Jam in Flower Town | 5 Nov 2023 02:37 | 2 | Can anyone give tests data or some discription? Edited by author 01.11.2023 14:24 Test 1 is the first sample test from the problem statement. | WA TEST #6. | Jumabek Alikhanov | 2020. Traffic Jam in Flower Town | 18 Mar 2019 12:32 | 2 | Can anyone give me some clue please? Re: WA TEST #6. George_Aloyan[PTS_Obninsk][MIPT_DPQE][MIPT_PSEPMS][IPG] 18 Mar 2019 12:32 Try this test: LFR FLR Ans should be 4, not 5 | accepted | Mikhail | 2020. Traffic Jam in Flower Town | 16 May 2018 00:23 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; string str1, str2; int main() { cin >> str1 >> str2; reverse(all(str1)); reverse(all(str2)); int ans = 0; while (!str1.empty() || !str2.empty()) { if (!str1.empty() && !str2.empty()) { char b1 = str1.back(); char b2 = str2.back(); if (b1 == b2 && b2 == 'L') str1.erase(str1.size() - 1, 1), str2.erase(str2.size() - 1, 1); else if (b1 == 'L') str2.erase(str2.size() - 1, 1); else if (b2 == 'L') str1.erase(str1.size() - 1, 1); else str1.erase(str1.size() - 1, 1), str2.erase(str2.size() -1, 1); } else if (str1.empty()) str2.erase(str2.size() - 1, 1); else str1.erase(str1.size() - 1, 1); ++ans; //cout << str1 << ' ' <<str2 << ' ' << ans << endl; } cout << ans << endl; } | Hint | IlushaMax | 2020. Traffic Jam in Flower Town | 6 Apr 2017 20:33 | 1 | Hint IlushaMax 6 Apr 2017 20:33 | WA №3 | George_Aloyan[PTS Obninsk][MIPT_FFKE] | 2020. Traffic Jam in Flower Town | 26 Apr 2016 18:37 | 2 | WA №3 George_Aloyan[PTS Obninsk][MIPT_FFKE] 21 Jul 2015 20:05 I had exactly the same mistake at the beginning. Check this case: FFF LLL Answer should be 6 (not 5). Hint: In your second check the counter 'j' could be advanced as the result of the first check which is wrong... |
|
|
|