Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | Test 66? | Shohruh | 1808. Чапаев на планете Океан | 3 сен 2021 18:43 | 1 | | | If WA9 | zwqzwq | 2104. Игра с полоской | 3 сен 2021 17:26 | 1 | If WA9 zwqzwq 3 сен 2021 17:26 Take attention: No matter whose turn it is,if all the color is A,than Alise win,else Bob win. | | Dose this problem have a way to find the answer intime? | zwqzwq | 1622. Endspiel | 3 сен 2021 16:00 | 1 | Just like the title,I know how to solve this problem,becouse I have played the game before,and I know there is a way to move the chess.But if somebody dosen't play the game at all before,than how can he solve the problem?(Sorry for my poor English) Edited by author 03.09.2021 16:00 | | WA10, help me please) | Roman Hrynevych | 1131. Копирование | 1 сен 2021 15:18 | 2 | #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main() { int n, k; scanf("%d %d", &n, &k); if (n < 1 || n > pow(10, 9) || k < 1 || k > pow(10, 9)) { return 0; } unsigned long long result = 0; unsigned long long buffer = 1; n--; for (int i = 0; n >= 0; i++) { n -= buffer; result++; buffer *= 2; if (n <= 0) { printf("%llu\n", result); return 0; } if (buffer >= k) { buffer = k; double count = (double)n / buffer; if (count != (long long)count) { count++; } result += count; printf("%llu\n", result); return 0; } } return 0; } Edited by author 21.01.2020 01:57 | | hint | Anton | 1423. Басня о строке | 31 авг 2021 16:33 | 1 | hint Anton 31 авг 2021 16:33 | | hint | Anton | 1671. Паутина Ананси | 29 авг 2021 01:02 | 1 | hint Anton 29 авг 2021 01:02 | | WA6 :) | pperm | 1540. Битва за кольцо | 28 авг 2021 19:29 | 3 | WA6 :) pperm 25 сен 2007 20:21 Give me some tests. Some my tests Input: 3 9 2 1 3 1 4 1 1 1 5 3 1 2 1 3 1 2 1 Output: G 1 2 Input: 1 5 2 3 1 4 5 Output: G 1 3 Input: 1 5 5 4 1 3 2 Output: G 1 1 Edited by author 25.09.2007 20:24 AAAA, yea, how stupid was I(( | | Accepted C# | Адель | 1025. Демократия в опасности | 28 авг 2021 19:18 | 2 | using System; using System.Linq; namespace e3 { class Program { public static void Main(string[] args) { int k=int.Parse(Console.ReadLine()); int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray(); int temp; for (int i = 0; i < k - 1; i++) { for (int j = 0; j < k - i - 1; j++) { if (arr[j] > arr[j + 1]) { // меняем элементы местами temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } }
int s=0; for (int i = 0; i < k/2+1; i++) { s=s+(arr[i]/2+1); } Console.WriteLine(s);
} } } Edited by author 28.08.2021 19:25 | | if you're getting tle | guilty spark | 1122. Игра | 25 авг 2021 23:18 | 1 | Try iterative instead of recursive. moves wont exceed 16. Edited by author 25.08.2021 23:18 Edited by author 25.08.2021 23:19 | | WA on test 5 | Kerem Puskullu | 1242. Оборотень | 25 авг 2021 15:04 | 1 | I tried all test cases which were written in the discussion part and my program gives the correct answer for all of them. How to find my error: #include <bits/stdc++.h> using namespace std; #define pb push_back #define endl "\n" /*DELETE IT ON INTERACTIVES!!*/ #define mod 1000000007 #define int long long #define double long double #define all(x) x.begin(), x.end() const int N = 1e3+5; vector<int> adj[N],marked(N,0),killed(N,0),vis_1(N,0),torun(N,1),vis_2(N,0); int ok; void dfs(int node){ vis_1[node] = 1; if(killed[node]) ok = 1; for(auto go : adj[node]){ if(!vis_1[go]){ dfs(go); } } } void mark(int node){ marked[node] = 1; vis_2[node] = 1; for(auto go : adj[node]){ if(!vis_2[go]){ mark(go); } } } void solve(){
int n; cin>>n; string s,t; while(cin>>s){ if(s == "BLOOD") break; cin>>t; adj[(int)s[0] - '0'].pb((int)t[0] - '0'); torun[(int)t[0] - '0'] = 0; } int a; while(cin>>a){ killed[a] = 1; } for(int i=1;i<=n;i++){ if(torun[i]){ dfs(i); if(ok){ mark(i); } fill(all(vis_1),0); fill(all(vis_2),0); ok = 0; } } int hehe = 0; for(int i=1;i<=n;i++){ if(!marked[i]){ hehe = 1; cout<<i<<' '; } } if(!hehe) cout<<0; } int32_t main(){
cin.tie(0); ios::sync_with_stdio(0); int t=1; //cin>>t;
while(t--) solve();
return 0; } | | IF WA 4 | zwqzwq | 1965. Саженцы груши | 25 авг 2021 13:58 | 1 | 5 1 2 3 4 5 shold be 4 1 1 2 3 4 5 (or others) but can't be 5 0 1 2 3 4 5 | | When one of them is outside, do they need to keep contact? | Chim se di nang | 1912. Руины титанов: проходя сквозь стены | 25 авг 2021 12:02 | 9 | What if one of them is outside the trap? Do they still need to keep contact (have at least one common corner)? Edited by author 20.10.2012 18:13 Yes, what's the answer for this test: 1 2 +.+-+ |1|2. +-+-+ ? UPD: i got accepted, answer for this test is 2. Too bad it doesn't clarify anything about original question, so I'll answer it: yes, they have to be in adjacent rooms even after one of them got out. Edited by author 23.10.2012 23:34 So the first one out must remain in contact with the other, but if the other can step out on the very next turn, and by stepping out they become separated, it's OK...? In my solution what you said is not allowed, but it seems like in optimal solution this situation can't happen. > In my solution what you said is not allowed Then shouldn't the answer to your example be 3 instead of 2 as your wrote? 1 up 1 right 2 right Your answer of 2 requires: 1 up 2 right But this separates them. Edited by author 25.10.2012 11:25 Yes, but there are no walls outside the given rectangle, so while executing "1 right" command you don't pass through thin wall and thus the answer isn't increased ;D Doh. Right you are. I did not read the problem statement properly. I was thinking it was "number of moves." I think yes.Because I got WA5 if no.But AC if yes. My English is very bad.Sorry. | | Python 3 | tdnnojtupbkmuhehvb | 1243. Развод семи гномов | 24 авг 2021 11:19 | 2 | Python 3 tdnnojtupbkmuhehvb 12 апр 2021 14:40 | | O(1) | zwqzwq | 1716. Альтернативное решение | 23 авг 2021 08:52 | 1 | O(1) zwqzwq 23 авг 2021 08:52 a is the number of NO ; b is the number of YES ans=a/n+(n-1)*(a/n)*(b/(n-1))+(n-1)*(b/n)*(a/(n-1)) =a/n+2ab/n =a*(1+2b)/n | | O(W*H) solution passes | LaVuna [NULP] | 1235. Cricket Field | 22 авг 2021 13:43 | 1 | O(W*H) solution passes Edited by author 22.08.2021 13:50 Edited by author 22.08.2021 13:50 | | Странное условие | ilalex | 1740. А олени лучше! | 22 авг 2021 00:32 | 6 | "чтобы любой отрезок пути длиной k километров пробегать ровно за h часов." Если ЛЮБОЙ отрезок длины к он пробегает за h, то разве из этого не следует, что скорость постоянна? Ну бежал от 99% пути со скоростью света А оставшийся 1% пути пробежал с такой скоростью (очень медленно пробежал) , чтобы получить суммарное время h часов Странность здесь в другом: какой может быть максимум времени, если не оговорены ограничения на траекторию поездки ?! Он ведь может кататься зигзагами, потерять в дороге паспорт и прочесывать тундру в его поисках, и т.п. Максимум равен бесконечности ! Edited by author 27.09.2018 01:21 Полностью согласен. Условие задачи явно кривое. | | Для тех, кто не понял | Daulet | 1740. А олени лучше! | 22 авг 2021 00:30 | 4 | Скорость оленей не ограничена, т.е. они могут хоть телепортироваться считай Здесь факт лишь в том, что они должны пробежать за H часов K километров По этому минимальное например при данных 30 11 2 будет равно 4 Объясняю: За 4 часа олени пробегут 22 км (ну, 11*2 просто) , и так как осталось 8 км, то они могут это расстояние просто перелететь (телепортнуться), ведь это меньше 11 км, поэтому им и время не нужно (они же не прошли 11, значит и 2 часа не нужно). А с максимальным все очень просто, это просто время если бы олени двигались с постоянной скоростью, но могли немного перебежать нужное расстояние(главное чтобы оно было не больше к) При 30 11 2 макс время будет 6 часов, тк только тогда олени достигнут своих 30км изначальных (ну немного больше пробегут - 33 км) Надеюсь кому-то поможет в решение The problem is just from Russia. Pay attention, the Chukchi is running, not an Eskimo, not an Indian, but a Chukchi. And in Russia everything is relative. And the position of the Chukchi is relative. That is, the Chukchi is located somewhere in the Yamal-Nenets district. On the territory within a radius of 100 kilometers from the telephone tower. In 2 hours he will be in an area within a radius of 100 kilometers from another telephone tower. That is, he will reach Moscow in 4 hours, plus or minus 2 hours. Something like this. Translation problems. Что-то ваши объяснения не очень логичны. Вы уверены, что именно эта логика заложена авторами задачи ? | | if WA 4 | Lemmiwinks | 1020. Ниточка | 20 авг 2021 20:42 | 2 | if WA 4 Lemmiwinks 24 июн 2021 20:22 use the formula sqrt(abs(x1 - x2)**2 + abs(y1 - y2)**2) not abs(x1 - x2) + abs(y1 - y2) | | WA2 | farmer.26 | 1590. Шифр Бэкона | 20 авг 2021 16:26 | 1 | WA2 farmer.26 20 авг 2021 16:26 Please give me some tests! | | an easy method | Celebrate | 1395. Pascal против C++. Версия 2 | 20 авг 2021 13:16 | 1 | (Please forgive me for my poor English.) First,use Hash to record ai Then,enumerate i,j as the first and the second items in the arithmetic sequence.check if 2*a[i]-a[j] exists.If it exists,we stop it immediately because the arithmetic sequence has been found.Otherwise,we find the arithmetic as brute force and mark the longest arithmetic sequence. At last,it's easy to restore the arithmetic sequence. So we can solve it in O(n^2). Edited by author 20.08.2021 13:43 |
|
|