Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | Clarification of problem statement | ROHAN GULATI | 1106. Две команды | 17 фев 2013 01:46 | 2 | Does the problem statement meant that each member should have all his friends in the other team OR each member should have at least 1 friend in the other team ? If the first statement is correct the sample output does not hold. Please clarify. Thanks in advance Edited by author 17.02.2013 01:32 > If the first statement is correct the sample output does not hold. Then how do you think which statement is correct? :) | | whats wrong | zipopa | 1001. Обратный корень | 15 фев 2013 22:25 | 1 | #include <iostream> #include <cmath> int i=0; using namespace std; void f(); int main() { cout.setf( ios::fixed ); cout.precision( 4 ); f(); return 0; } void f() { long int a; if (cin >> a) f(); if (i!=0) { cout << sqrt((double)a) << endl;} else i++; } | | was getting wrong ans then got accepted.. | shubham agrawal | 1014. Произведение цифр | 15 фев 2013 22:18 | 1 | use long long int instead of int , it may help.. | | Why WA on test#6???? | wangyin | 1406. Следующее число | 15 фев 2013 18:23 | 2 | Edited by author 20.08.2006 07:47 | | Hint for this problem | 198808xc | 1565. Необычная дуэль | 15 фев 2013 17:35 | 3 | This is a problem with possible loops in decision. That means your decision will be based on others' decision, which might again be based on yourself. I think the best way to solve this sort of problems is to use ITERATION. I believe that some people could solve this directly. If you are like this, please post your idea or formula, I want to know it very much. During iteration, we must pay attention to the initialization value. If you have a bad init-value, you will not be able to move even one step in this problem. In my opinion, the init-value could be set as: when someone is starting a duel, then he could win this duel with prob 1. By the way, iteration will stop very quickly, as the calculation is unusual: there is function "MAX". So do not worry about the complexity of the problem. At last, some test-data here: 1.0 0.8 0.5 0.30000000 0.17777778 0.52222222 1.0 0.5 0.0 0.75000000 0.25000000 0.00000000 1.0 1.0 0.0 0.50000000 0.50000000 0.00000000 1 0.9 0.8 0.11000000 0.08265306 0.80734694 1 0.99999 0.99998 0.00001000 0.00001000 0.99998000 (Suprising or not?) 1 0.0001 0.0002 0.99975002 0.00014998 0.00010000 So, Good luck. Thanks for your hint. I got WA12, then I increase iteration to 5000 times, it ac now. My AC solution doesn't use iterations. It is based on some formulas. Rules of the forum says that I mustn't post my solution. But I can send my solution to you if you want to. | | WA 21 | bayram | 1011. Кондукторы | 15 фев 2013 16:27 | 1 | WA 21 bayram 15 фев 2013 16:27 when you calculate q you must use (res-(1e-7))*q/100.0; | | about abababa | data lapiashvili | 1723. Книга Сандро | 15 фев 2013 13:25 | 5 | is in your example abababa right answer aba or only a??? because a is 4 and aba is 3. test №1: "abababa" ; correct answer: "a" test №2: "abcde" ; correct answer: "abcde" For "abcde" correct: a, b, c, d, e, ab, bc, cd, de, abc, bcd, cde, abcd, bcde, abcde Edited by author 15.11.2010 10:11 why correct answer is "a" , in my opinion answer must be "ababa" cause prefix is like that 0 0 1 2 3 4 5 | | flaky problem statement | tyomitch | 1310. Диагностика ACM | 15 фев 2013 00:55 | 2 | "choosing" -> "chosen" "divided" -> "divisible" "satisfied" -> "satisfying the" "is really completely defines" -> "completely defines" These aren't just typos, they impede the understanding. | | Question! | uzairBaig | 1350. Столовая | 14 фев 2013 16:54 | 3 | I cannot understand the problem. The question is phrased pOorly ! If there is anyone, who can tell me, the question clearly, I am ready to phrase it in a better way. Use this statements: 1) There are N different food stuffs in the menu but not all of them are at the distribution. 2) The food is cooked from M different food stuffs. 3) The first student eats and he is not poisoned. 4) The first block describes the food stuffs dangerous for the first student, 5) the next K blocks — for the rest ones. And try to think a little. It's not very hard. ;) Combination formula can help. | | Can anybody interpret the promblem for me? thx | ppchain | 1716. Альтернативное решение | 13 фев 2013 18:08 | 2 | The "YES" come from two ways:1) when there is not have answer.txt;2) when answer.txt contain it.but i can't figure out this related to pass test! pass test should be the output.txt's content is same to answer.txt. how to explain the hint's explanation? We answer "YES" if "YES" was right answer for previous test. | | I do not know how to solve it in C++. | Martin | 1716. Альтернативное решение | 13 фев 2013 18:06 | 3 | No matter when I used double or long double, my code still got TLE. Opt[Now][j][0] = Opt[Pre][j][0] + Opt[Pre][j][1] + Opt[Pre][j][3]; Opt[Now][j][1] = Opt[Pre][j - 1][0] + Opt[Pre][j - 1][2] + Opt[Pre][j - 1][1]; Opt[Now][j][2] = Opt[Pre][j][2] + Opt[Pre][j][3]; Opt[Now][j][3] = Opt[Pre][j - 1][2] + Opt[Pre][j - 1][3]; I had to write a Pascal code using extended and got AC. Could anyone tell me how to AC in C++? I know solution which can be written on all allowable languages. I suppose, this solution won't get TLE. Becouse it is O(1). I know solution which can be written on all allowable languages. I suppose, this solution won't get TLE. Becouse it is O(1). | | cub(N) Solution | aybek | 1297. Палиндромы | 13 фев 2013 14:42 | 1 | I don't know why this solution is correct, but it got accepted. I thought that this solution will get TL. Author of problem: easy tests? Who couldn't find solution try to understand this code: #include<map> #include<cmath> #include<ctime> #include<vector> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> #include<iostream> #include<string.h> //#include<windows.h> #include<algorithm> #define y1 abcde #define sqr(x) ((x)*(x)) #define INF 20000000000000000 using namespace std; string s; int i,n,ans,j,l,r;
bool check(int l,int r) { for(int i = 0; i < (r - l + 1) / 2; i++) if (s[l+i] != s[r-i]) return false; return true; } int main() { //srand(GetTickCount()); #ifndef ONLINE_JUDGE freopen("a.in","r",stdin); freopen("a.out","w",stdout); #endif cin>>s; n = s.size(); i++; s = '#' + s; for(i = 1; i <= n; i++) for(j = i; j <= n; j++) { if (check(i,j)) if (j - i + 1 > ans) ans = j-i+1, l = i, r = j; } for(i = l; i <= r; i++) cout<<s[i]; return 0; } Edited by author 13.02.2013 14:44 Edited by author 13.02.2013 14:45 | | Test #2 | George | 1910. Руины титанов: сокрытый вход | 13 фев 2013 00:29 | 1 | | | Algo. | IgorKoval(from Pskov) | 1647. Раздел острова | 12 фев 2013 23:33 | 5 | Algo. IgorKoval(from Pskov) 9 апр 2012 02:25 What is algorithm? What formulas, theorems, equations and hints must I use? Re: Algo. IgorKoval(from Pskov) 15 май 2012 22:53 Suppose that answer is XY, where point X lies on CA and Y lies on CB. Then let CX = x, CY = y. Now you have two equations: x + y = P/2, x * y = CA * CB / 2 (P is perimeter). The rest of solution is straightforward. Re: Algo. IgorKoval(from Pskov) 16 май 2012 23:59 Thank you very much! Very good adia! P.S.: How get x * y = CA * CB / 2 ? Just simple: 2 * SQUARE_CXY == SQUARE_ABX 2 * 0.5 * x * y * sinXCY == 0.5 * CA * CB * sinXCY x * y == 0.5 * CA * CB x * y = CA * CB / 2 I think about it several minute. =) | | WHY "Runtime error" ????!!!!!! | Iuhenio{PSU} | 1821. Биатлон | 12 фев 2013 23:06 | 1 | using System; class Program { static void Main() { int N = int.Parse(Console.ReadLine()); if (N > 0 && N <= 100) { string[,] IData = new string[N, 3]; string[] buf = new string[2]; for (int i = 0; i < N; i++) { buf = Console.ReadLine().Split(' '); IData[i, 0] = buf[0]; IData[i, 1] = buf[1]; IData[i, 2] = Convert.ToString(i + 1); } String[] Win = new string[N]; string[] Lider = new string[2]; Lider = IData[0, 1].Split(':'); int k = 0; for (int i = 1; i < N+1; i++) { buf = IData[i, 1].Split(':'); if (int.Parse(Lider[0]) > int.Parse(buf[0])) { if (i == 1 && (60 - double.Parse(buf[1].Replace(".", ",")) + double.Parse(Lider[1].Replace(".", ",")) < 30)) { Win[k] = IData[0,0]; k++; } Win[k] = IData[i, 0]; k++; Lider = IData[i, 1].Split(':'); } if (int.Parse(Lider[0]) == int.Parse(buf[0])) { if (double.Parse(Lider[1].Replace(".", ",")) > double.Parse(buf[1].Replace(".", ","))) { double tmp = double.Parse(Lider[1].Replace(".", ",")) - double.Parse(buf[1].Replace(".", ",")); if (i == 1 && tmp < 30) { Win[k] = IData[0, 0]; k++; } Win[k] = IData[i, 0]; k++; Lider = IData[i, 1].Split(':'); } } if (int.Parse(Lider[0]) < int.Parse(buf[0])) { Win[k] = IData[0, 0]; k++; } } Console.WriteLine(k); Array.Sort(Win); for (int i = 0; i < k; i++) { Console.WriteLine(Win[i]); } } } } Edited by author 12.02.2013 23:07 | | Идея | ibra (TNU) | 1414. Астрономическая база данных | 12 фев 2013 21:25 | 2 | Идея ibra (TNU) 11 янв 2012 15:04 Несмотря на то, что задача просто решеется с помощью std::set, я написал сжатый бор. Первый раз писать немного сложно, но весело. А теперь ещё и просто. а если в вершинах бора хранить не map<string, node*> а попроще map<pair<int, int>, node*>, то я думаю результат был бы более впечатлительным P.S. решайте сжатым бором Accepted 0.312 2 904 КБ Edited by author 11.01.2012 15:06 Re: Идея Andrew Sboev [USU] 12 фев 2013 21:25 Pff, too easy with just map<string, bool>. 0,937s is enough. | | puzzle | lian lian | 1057. Количество степеней | 12 фев 2013 20:54 | 5 | puzzle lian lian 3 сен 2008 10:23 my program output result: 1 1000000000 3 13 -> 84 1 1 2 2 ---> 0 1 100 2 4 ->6 1 300 4 8 ->0 1 400 4 2 ->111 1 2147483647 13 3 --> 77520 1 2147483647 20 2 --> 84672315 1 3 1 2 --> 2 is right? if full right , but i alway wa #7, who can give much testdata to me ? Edited by author 03.09.2008 10:39 Edited by author 05.09.2008 02:08 all your answers are correct. tests you asked: 1 8 2 3 --> 1 1 900 2 10 --> 3 1 123456789 4 10 --> 126 1 999999999 8 10 --> 9 Thanks for your test,I'v got AC this problem! all your answers are correct. tests you asked: 1 8 2 3 --> 1 1 900 2 10 --> 3 1 123456789 4 10 --> 126 1 999999999 8 10 --> 9 Thanks from me too for the excellent testset! | | no impossible case???? | HM2P33 | 1106. Две команды | 11 фев 2013 21:51 | 2 | i've got AC but i omitted the case "impossible" (ie print "0"). it has always solution? >>Well, there is no solution, for example, if someone has no friends. UPD: Yes, I didn't read it correctly and I think there are really no impossible cases. Edited by author 11.02.2013 21:53 | | What is the answer for the such test case | Megakrit | 1837. Число Исенбаева | 11 фев 2013 21:46 | 2 | e.g. the input is (if I'm not wrong it's valid input): 3 Isenbaev A B A A A B B B What is the correct answer? My AC Solution's output: =============== A 1 B 1 Isenbaev 0 =============== | | Access violation N 3 | Lord_F | 1837. Число Исенбаева | 11 фев 2013 21:45 | 2 | #include <cstdio> #include <deque> #include <queue> #include <vector> #include <string> #include <set> #include <stack> #include <algorithm> #include <cmath> #include <iostream> #include <fstream> #include <climits> #include <cfloat> #include <map> #include <cstring> #define FOR(i,s,e) for(long i = s; i < e; ++i) #define FORD(i,e,s) for(long i =e-1; i>=s; --i) #define read(a) scanf("%ld",&a); #define readf(a) scanf("%lf",&a); #define read2(a,b) scanf("%ld %ld",&a,&b) #define read2f(a,b) scanf("%lf %lf",&a,&b) #define write(a) printf("%ld ",a); #define writef(a) printf("%lf ",a); #define write2(a,b) printf("%ld %ld ",a,b) #define write2f(a,b) printf("%lf %lf ",a,b) #define writeln(a) printf("%ld\n",a); #define writelnf(a) printf("%lf\n",a); #define writeln2(a,b) printf("%ld %ld\n",a,b) #define writeln2f(a,b) printf("%lf %lf\n",a,b) #define nln printf("\n") #define elif else if #define MOD 1000007 #define EPS 1e-9 #define INF 2117117117 #define mp(a,b) make_pair(a,b) #define dist(x1,y1,x2,y2) sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) #define pb(a) push_back(a) using namespace std; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); long n; read(n); scanf("\n"); map<string, long> m; vector<long> g[318]; long c=0; string s1,s2,s3; FOR(i,0,n) { getline(cin,s1,' '); if (m.find(s1)==m.end()) m.insert(mp(s1,c++)); getline(cin,s2,' '); if (m.find(s2)==m.end()) m.insert(mp(s2,c++)); getline(cin,s3,'\n'); if (m.find(s3)==m.end()) m.insert(mp(s3,c++)); long a=m.find(s1)->second,b=m.find(s2)->second,c=m.find(s3)->second; g[a].pb(b); g[a].pb(c); g[b].pb(a); g[b].pb(c); g[c].pb(a); g[c].pb(b); } long d[318]; FOR(i,0,c) d[i]=-1; long s = m.find("Isenbaev")->second; d[s]=0; queue<long> q; q.push(s); long v; while (!q.empty()) { v=q.front(); q.pop(); FOR(i,0,g[v].size()) { if (d[g[v][i]]==-1) { d[g[v][i]]=d[v]+1; q.push(g[v][i]); } } } map<string, long>::iterator it; for( it = m.begin(); it != m.end(); ++it) { printf("%s ",it->first.c_str()); if (d[it->second]==-1) printf("undefined"); else write(d[it->second]); nln; } return 0; } Why?? Oh, I see now, there is no Isenbaev in the 3rd test, so all people are undefined. |
|
|