Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA4 Test | Gleb | 1570. Eating High | 3 Jul 2018 12:23 | 1 | | | WA #13. Dear Author, please comment | Darwin's Grove | 1964. Chinese Dialects | 3 Jul 2018 08:03 | 5 | long min = n; for (int i = 0; i < k; i++) for (int j = i + 1; j < k; j++) { long diff = (data[i] + data[j] - n); if (diff < min) min = diff; } Console.WriteLine(min < 0 ? 0 : min); Sorry, it's my fault. This case find Max, not Min. Does you algorithm work (with your last changes)? It probably shouldn't (if I am correct) Consider the following 3 3 2 2 2 The answer, program will give you in this case is 1 But i can easily prove it is wrong: First man speaks dialects 1 and 2 Second one speaks dialects 2 and 3 The third speaks dialects 3 and 1 Therefore there is nobody, who can speak all three dialects | | in case of WA#4 | nikitaevg | 1964. Chinese Dialects | 3 Jul 2018 06:56 | 4 | Just use __int64 instead of long long. That helped me. int is enough for this problem. Using 64-bit ints didn't matter for my solution. However, this test case helped me fix WA 4: 10 3 5 4 8 | | Poor test case | Haloom | 1404. Easy to Hack! | 2 Jul 2018 18:44 | 1 | the original answer of fskdkskylp is ansthisone but my accepted code give this answer aêsthisone. my accepted code #include<bits/stdc++.h> using namespace std; int main() { char c[104]; scanf("%s",c); int l=strlen(c); int a[l+5]; int b[l+5]; for(int i=0; i<l; i++) { a[i]=c[i]-'a'; } b[0]=a[0]; if(a[0]<5) { b[0]=b[0]+26; } for(int i=1; i<l; i++) { int j=1; while((b[i]=a[i]+j*26)) { if(b[i]%26==a[i]&& b[i]>=b[i-1]) break; j++; } } printf("%c",b[0]-5+'a'); for(int i=1; i<l; i++) { int j=abs(b[i]-b[i-1]); printf("%c",j+'a'); } printf("\n"); return 0; } | | WA5 test (AC program) | Gleb | 1389. Roadworks | 2 Jul 2018 14:15 | 1 | 9 8 1 2 1 6 1 8 1 3 1 4 4 5 1 7 7 9 Answer: 3 7 9 1 2 4 5 | | If you've got WA #11 | Pavel Khaustov [Tomsk PU] | 1542. Autocompletion | 30 Jun 2018 19:16 | 4 | If you've got WA #11 then your program deals bad with repeatative queries. Try this test: -------------------- 2 acm 10000 acmicpc 10000 2 ac ac --------------------- Correct answer is: --------------------- acm acmicpc acm acmicpc --------------------- this code works fine for above input but still gives wa#11 I believe, this will help you 18 a 10 ba 0 bb 1 bc 1 bd 1 be 1 bf 1 bg 1 bh 1 bi 1 bj 1 bk 1 bl 1 bm 1 bn 1 bo 1 bp 1 bq 1 1 b ba can't be with zero frequency: 1 ≤ n_i ≤ 106 | | question (+) | vav[14] | 1673. Admission to Exam | 29 Jun 2018 19:59 | 3 | Is it true that k=f(n), where f(n) is Euler function? Edited by author 13.02.2009 22:03 Re: question(+) Vedernikoff Sergey (HSE: EconomicsForever!) 13 Feb 2009 21:56 Yes =) 2 ADMINS: don't delete this hint. Really, it's easy to think it out - harder is to write If anyone got stuck with this. here is the well-known formula for computing phi function: phi(n) = product of [ p^{a - 1} * (p - 1) ], where factorized n = product [ p^a ]. The problem has a pretty fast brute force solution. Once you find a number K such that (K + 1) is prime and K divides phi(n) try to construct n with this prime (multiply by (K + 1) once and continue while phi(n) / (K + 1)^b is a multiple of (K + 1)). | | WA8 | Alex | 2056. Scholarship | 28 Jun 2018 20:14 | 1 | WA8 Alex 28 Jun 2018 20:14 | | HINT! | Yegor Suvorov | 1036. Lucky Tickets | 26 Jun 2018 11:29 | 13 | HINT! Yegor Suvorov 20 May 2007 15:45 Answers for big tests is very big. For example, for test "50 500" answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321". Don't use long long or int64! Use long numbers (long arithmetic)! (Длинная арифметика) I dont have idea. Who can explain to me, how to solve this problem? thx a lot. Thank you for your hint,though I know to use long arithmetic(my arithmetic is wrong). I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. The "HINT!" from Yegor Suvorov is correst, so yours is not. Re: HINT! unlucky [Vologda SPU] 8 Feb 2010 01:16 Thanks!!!:) Edited by author 19.11.2010 11:14 Edited by author 28.10.2015 19:11 Yes, I think so! I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. no! the answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321" Edited by author 03.01.2017 23:05 hints :- 50 500 854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321 ( this ans is correct ) make sure value of each digit must not exceed 9 | | Some hint. | MrBones | 1943. Space Rummy | 26 Jun 2018 00:15 | 2 | It's really very easy problem! Just shuffle! Indeed, I solved this problem by repeatedly testing random shuffles and printing NO if none of them was winning. | | Wrong Answer on Test Case 2, Help me out | ismail5g | 1086. Cryptography | 25 Jun 2018 19:11 | 1 | #include<bits/stdc++.h> using namespace std; int arr[15000],newarr[15000]; void sieve() { arr[0]=1; arr[1]=1; newarr[1]=2; for(int i=4; i<15000; i+=2) arr[i]=1; for(int i=3; i<15000; i+=2){ if(arr[i]!=1){ for(int j=i*2; j<15000; j+=i){ arr[j]=1; } } } } int main() { int n, t, k=1; sieve(); //cin>>n; for(int i=1; i<15000; i++){ if(arr[i]!=1){ newarr[k]=i; k++; } } cin>>t; while(t--){ cin>>n; cout<<newarr[n]<<endl; } return 0; } | | Hint | KALO | 1246. Tethered Dog | 25 Jun 2018 12:52 | 2 | Hint KALO 21 Nov 2010 18:23 Calculate the signed area of the polygon... Firstly, find any point with largest X (or Y) coordinate and then compute the cross product of two vectors formed by two adjacent points and this point. You need to find a point with largest X (or Y) coordinate as the polygon is not convex. | | accepted | Mikhail | 1821. Biathlon | 22 Jun 2018 17:20 | 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; vector< tuple <int, int, string> > v; vs ans; int calc() { string ans; cin >> ans; re (ans[0] - '0') * 6000 + (ans[1] - '0') * 600 + (ans[3] - '0') * 100 + (ans[4] - '0') * 10 + (ans[6] - '0'); } int main() { int best = (int) 1e9, n, cur; cin >> n; string str; fo(i, n) { cin >> str; cur = calc(); v.pb(make_tuple(cur + i * 300, cur, str)); } sort(all(v)); int finish, res; fo(i, v.size()) { tie(finish, res, str) = v[i]; if (res < best) { best = res; ans.pb(str); } } sort(all(ans)); cout << ans.size() << endl; for (auto &j : ans) cout << j << '\n'; re 0; } Edited by author 22.06.2018 17:22 | | Very funny problem | [MSU Detritus] freopen | 1761. Binary Palindrome | 21 Jun 2018 19:31 | 2 | I wrote suffix automaton, and with it's help i found solution in 5 lines. Hello!How are you?You are very clever!Help me,please))My problem is "Runtime error" | | OMG, this problem is too easy!!!! | bsu.mmf.team | 1761. Binary Palindrome | 21 Jun 2018 19:28 | 4 | It's unbelieveable, how couldn't I solve it during the contest. Just brute-force for finding answers for smalls n... Hmm no, not so easy, if you do it with pen and paper, it's too easy to overlook the palindromes. You need the results for N<40 before the generic solution becomes obvious. Hello!How are you?You are very clever!Help me,please)I'm confused.My problem is "Runtime error" Hello!How are you?You are very clever!Help me,please)I'm confused.My problem is "Runtime error" | | O(n^3) got 0.826s AC! | paulzrm | 1280. Topological Sorting | 21 Jun 2018 17:34 | 1 | I can't belive it! for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if(can[i][j]) for(k=1;k<=n;k++) if(can[j][k]) can[i][k]=1; } } | | segment tree AC 0.015 | Otabek Toshkanov | 1028. Stars | 21 Jun 2018 03:04 | 1 | | | accepted | Mikhail | 1423. String Tale | 20 Jun 2018 20:48 | 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; void Z_function (string &str, vi &z) { int n = str.size(); z.resize(n, 0); for (int i = 1, l = 0, r = 0; i < n; ++i) { if (i <= r) { z[i] = min(r - i + 1, z[i - l]); } while (i + z[i] < n && str[z[i]] == str[i + z[i]]) ++z[i]; if (i + z[i] - 1 > r) l = i, r = z[i] + i - 1; } } string str, s; vi z; int main() { int n; cin >> n >> str >> s; str += '$'; str += s; str += s; Z_function(str, z); fo(i, (int)z.size()) { if (z[i] == n) { cout << i - n - 1 << endl; re 0; } } cout << -1 << endl; re 0; } | | Теряюсь в догадках, Что не так? | VladGrin | 1585. Penguins | 20 Jun 2018 16:05 | 2 | #include <stdio.h> #include <string.h> #include <stdlib.h> #include <conio.h> int main() { int N; int i; int emp = 0, mac = 0, lit = 0; scanf("%i",&N); char **str = (char**)malloc(N * sizeof(char)); for(i = 0; i < N; i++) str[i] = (char*)malloc(20); fflush(stdin); for(i = 0; i < N; i++) gets(str[i]); for(i = 0; i < N; i++) { if(strcmp(str[i], "Emperor Penguin") == 0) emp++; if(strcmp(str[i], "Macaroni Penguin") == 0) mac++; if(strcmp(str[i], "Little Penguin") == 0) lit++; } if(emp > mac && emp > lit) printf("%s\n", "Emperor Penguin"); if(mac > emp && mac > lit) printf("%s\n", "Macaroni Penguin"); if(lit > mac && lit > emp) printf("%s\n", "Little Penguin"); for(i = 0; i < N; i++) free(str[i]); free (str); return 0; } | | Visual C++ Accepted | mNT | 1068. Sum | 20 Jun 2018 16:00 | 3 | #include <iostream> using namespace std; int main() { int n; int c = 0; cin >> n; if (n>0) { for (int i = 1; i <= n; i++) c += i; cout << c; } else if (n <= 0) { for (int i = n; i <= 1; i++) c += i; cout << c; } return 0; } Mmm... What?) Edited by author 20.06.2018 16:02 |
|
|