Show all threads Hide all threads Show all messages Hide all messages | hint for wa24 | Anton | 1612. Tram Forum | 25 Jul 2021 06:50 | 1 | check your last string after FOR. I missed this but now Accepted. | Hint for WA6 | Leonid (SLenik) Andrievskiy | 1612. Tram Forum | 14 Jun 2021 10:15 | 6 | Try this tests INPUT tram OUTPUT Tram driver INPUT tram.tram trolleybus OUTPUT Tram driver Edited by author 10.03.2010 23:01 Test 6 is <tram,> or <trolleybus,>. (whitout <>) ;-) Edited by author 28.02.2014 17:38 | WA 25 | jiyujie | 1612. Tram Forum | 14 Jun 2021 10:14 | 3 | WA 25 jiyujie 12 Apr 2012 21:34 i need some test... i guess the mistake is about "tram", i don't know which pattern of "tram*" should be counted I had a WA25 when didn't count last word. I assume there are empty lines there | c++ regex save me | Haloom | 1612. Tram Forum | 10 May 2019 11:34 | 1 | #include<bits/stdc++.h> using namespace std; map<string,int>mp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; string tr="tram"; string tro="trolleybus"; string last=""; while(getline(cin,s)) { string subject=s; regex re("\\w+"); sregex_iterator next(subject.begin(), subject.end(), re); sregex_iterator end; while (next != end) { smatch match = *next; last=match.str(); if(last==tr) mp[tr]++; else if(last==tro) mp[tro]++; next++; } } if(mp[tro]>mp[tr]) cout<<"Trolleybus driver"<<endl; else if(mp[tr]>mp[tro]) cout<<"Tram driver"<<endl; else cout<<"Bus driver"<<endl; } | Test 6, can anyone help? | Markfryazino | 1612. Tram Forum | 6 Sep 2018 01:01 | 1 | That's the code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1612trams_b { class Program { static void Main(string[] args) { string[] sArray = Console.In.ReadToEnd().Split(); char[] separator = { ' ', ',', '.', '\n', '-', ':', '!', '?' }; //string[] sArray = Console.ReadLine().Split(separator); int numTram = 0, numTrol = 0; foreach (string s in sArray) if (s == "tram") numTram++; else if (s == "trolleybus") numTrol++; if (numTram > numTrol) Console.WriteLine("Tram driver"); else if (numTram < numTrol) Console.WriteLine("Trolleybus driver"); else Console.WriteLine("Bus driver"); //Console.Read(); } } } Can anyone tell a test that can go wrong here? | accepted | Mikhail | 1612. Tram Forum | 4 Jun 2018 13:41 | 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; int main() { string a = "tram", b = "trolleybus", str; int ans = 0; while (cin >> str) { fo(i, (int)str.size() - (int)a.size() + 1) { if (str.substr(i, a.size()) != a) continue; if (!i && (str.size() == a.size() || 'a' > str[a.size()] || str[a.size()] > 'z')) ++ans; if (i && ('a' > str[i - 1] || str[i - 1] > 'z') && (i + a.size() == str.size() || 'a' > str[i + a.size()] || str[i + a.size()] > 'z')) ++ans; } fo(i, (int)str.size() - (int)b.size() + 1) { if (str.substr(i, b.size()) != b) continue; if (!i && (str.size() == b.size() || 'a' > str[b.size()] || str[b.size()] > 'z')) --ans; if (i && ('a' > str[i - 1] || str[i - 1] > 'z') && (i + b.size() == str.size() || 'a' > str[i + b.size()] || str[i + b.size()] > 'z')) --ans; } } if (ans > 0) cout << "Tram driver\n"; else if (ans < 0) cout << "Trolleybus driver\n"; else cout << "Bus driver\n"; } | if you have WA25 | WA24 (Java | C#) | Maxm | 1612. Tram Forum | 21 Apr 2018 20:22 | 1 | String symbols = "`~!№*@#$%^&*()-_=+\\|[{]};:'\",<.>/?в„– \n\r\t"; ;) | some tests | FrostCode | 1612. Tram Forum | 22 Jun 2016 01:50 | 2 | Input: trams trolleybuses trambus bus Output: Bus driver Input: tram tramtrolleybus bus Output: Tram driver Input: trams trolleybus trolleybus tram! tram. Output: Bus driver Input: bus bus tratrolleybus trolleybu tra. Output: Bus driver Input: trams trolleybuses trambus bus Output: Bus driver Input: tram tramtrolleybus bus Output: Tram driver Input: trams trolleybus trolleybus tram! tram. Output: Bus driver Input: bus bus tratrolleybus trolleybu tra. Output: Bus driver Thanks a lot... :) | hint wa22 | Evgeniy[VVV] | 1612. Tram Forum | 29 Jan 2015 16:29 | 1 | check this test: tram,tram Right answer is Tram driver :) Edited by author 29.01.2015 16:30 | easypeezyproblem | Minayev {SESC USU} | 1612. Tram Forum | 13 Nov 2014 17:21 | 1 | My code in Python from sys import stdin a=stdin.read() tab={} for x in range(256): if not chr(x).isalpha(): tab[x]=32 a=a.translate(tab) a=a.split() tram=a.count('tram') trol=a.count('trolleybus') if tram>trol: print("Tram driver") elif trol>tram: print('Trolleybus driver') else: print('Bus driver') Edited by author 13.11.2014 17:21 | AC Java using Reg expression | Paata Julakidze[GTU] | 1612. Tram Forum | 19 Apr 2014 17:26 | 1 | "-|[.|,|!|?|-|:|\t|\n|\r|\\s]" | wa22 | Pasky | 1612. Tram Forum | 28 Feb 2014 17:40 | 4 | wa22 Pasky 25 Apr 2008 16:32 check this test: tram.tram what output should be? bus driver? tram driver? Re: wa22 Egor Stepanov [mikroz] 5 Dec 2008 06:16 Re: wa22 [RISE] Juri Watjan [RAU] 28 Feb 2014 17:40 Test 22 is tram,tram or trolleybus,trolleybus - check this )) | help read data in Java | Anna | 1612. Tram Forum | 24 Nov 2013 23:16 | 1 | Hello, pleaze help me to read data correctly in Java. I've spend a lot of time with no result. | WA #24 | FBI | 1612. Tram Forum | 21 Nov 2013 11:45 | 1 | Who can tell test 24? May b someone also got in trouble with this test. | To admins | alex_r | 1612. Tram Forum | 18 Jan 2013 19:13 | 3 | Could you please check my submissions. The accepted one (I actually copy-pasted it from this forum) gives wrong answer to the following data set: tram (only 4 symbols in input.txt file) The output is "Bus driver". My original solution (#4725054) gives "Tram driver" answer to the mentioned data set, but fails on test #6. Can you please give information what is wrong with this test? Thank you. Last line of input data is always terminated with end of line character (it is the usual rule of Timus Online Judge), so this test is incorrect. Ok, got this. So I assume the problem is on my side. Will try to find what is wrong | No subject | TESTER | 1612. Tram Forum | 12 Apr 2012 22:04 | 2 | anyone knows test 6, I have been with this problem for 1 hour test 6 should take account ",.?!-: " | AC Solution C#: Use Linq | Hikmat Ahmedov | 1612. Tram Forum | 9 Mar 2012 00:12 | 1 | // ----------SOLVED------------ using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { /* Here we include all word separators */ string[] ss = Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r','.',',','!','?','-',':'}, StringSplitOptions.RemoveEmptyEntries); /* From the word list select just "tram" and "trolleybus" by Grouping we know how many times these words appear by ordering we make sure that "tram" comes first in the list r[] if both words appear in the input */ var r = (from u in ss where u == "tram" || u == "trolleybus" group u by u into uu orderby uu.Key select new { key=uu.Key, count=uu.Count() } ).ToList(); /* The rest is just printing the output basing on the results of the query */ if (r.Count == 0) Console.WriteLine("Bus driver"); else if (r.Count == 1) Console.WriteLine("{0}", r[0].key == "tram" ? "Tram driver" : "Trolleybus driver"); else if (r[0].count > r[1].count) Console.WriteLine("Tram driver"); else if (r[0].count < r[1].count) Console.WriteLine("Trolleybus driver"); else Console.WriteLine("Bus driver"); } } | Why am i constantly getting WA24? | ONU_1785 | 1612. Tram Forum | 7 Jan 2012 01:40 | 3 | Edited by author 07.01.2012 01:46 Edited by author 07.01.2012 01:46 | Why WA on test 24?! | ilya_romanenko | 1612. Tram Forum | 4 Sep 2011 20:32 | 2 | Please people help! Can anybody tell me test 24? const tr='tram'; trol='trolleybus'; mmm=' `~!@#$%^&*()-_=+\\|[{]};:\",<.>/?¹0123456789'; var tr1,tr2,a,b,c,i:integer; s:widestring; begin b:=1; tr1:=0; tr2:=0; c:=0; while(not seekEOF)do begin c:=0; readln(s); while(pos(tr,s)>0)do begin c:=0; for i:=1 to 45 do if(s[pos(tr,s)+4]=mmm[i])then inc(c); if(pos(tr,s)+4=length(s))then inc(c); if((ord(pos(tr,s)+4)=39)or(ord(pos(tr,s)+4)=96))then inc(c); if(c=0)then begin delete(s,pos(tr,s),4); end else begin inc(tr1); delete(s,pos(tr,s),4); end; end; c:=0; while(pos(trol,s)>0)do begin c:=0; for i:=1 to 45 do if(s[pos(trol,s)+10]=mmm[i])then inc(c); if(pos(trol,s)+10=length(s))then inc(c); if((ord(pos(trol,s)+10)=39)or(ord(pos(trol,s)+10)=96))then inc(c); if(c=0)then begin delete(s,pos(trol,s),10); end else begin inc(tr2); delete(s,pos(trol,s),10); end; end; inc(b); end; if(tr1>tr2)then writeln('Tram driver') else if(tr2>tr1)then writeln('Trolleybus driver') else if(tr2=tr1)then writeln('Bus driver'); end. P.S. Sorry for bad English. Edited by author 31.05.2011 00:05 Now is AC. Two small mistakes... | Why WA on Test 24? | Dr Zhihua Lai | 1612. Tram Forum | 28 Aug 2011 22:49 | 2 | Edited by author 01.12.2011 22:52 now AC, a small mistake... |
|
|