| Show all threads Hide all threads Show all messages Hide all messages |
| tle on 21 | daizhenyang | 1651. Shortest Subchain | 3 Mar 2011 13:10 | 2 |
who can help me? I use bfs. use dynamic programming seq:1 2 7 3 2 8 4 8 5 dp :1 2 3 4 2 3 4 3 4 dp[i] -> dp[i+1] or dp[i] -> dp[j] while seq[i] == seq[j] Notice that if much j exists, just goto the smallest j the algorithm is O(N) P.S : why netflow doesn't work now ? :) |
| test | grisha[SIAL 2010] | 1459. Archer's Travel | 2 Mar 2011 23:41 | 2 |
test grisha[SIAL 2010] 2 Mar 2011 13:20 Please, give me test 12. Very need. The only thing I know about this test is N < 4. |
| WHILE NOT SEEK EOF | MOPDOBOPOT (USU) | 1069. Prufer Code | 28 Feb 2011 23:07 | 1 |
|
| WA8 | Timur Sitdikov (MSU TB) | 1220. Stacks | 28 Feb 2011 21:20 | 1 |
WA8 Timur Sitdikov (MSU TB) 28 Feb 2011 21:20 If WA8, try test 100000 PUSH 1 1 PUSH 1 2 .... PUSH 1 99990 POP 1 ... POP 1 Right answer: 99990 ... 99981 |
| what answer? | Vit Demidenko | 1503. Polynomial | 28 Feb 2011 21:07 | 2 |
What answer for 3 1 0 3 0 ? 0 0 0 or 0 ? |
| wa17 | hatred | 1773. Metro to Every Home | 28 Feb 2011 01:06 | 1 |
wa17 hatred 28 Feb 2011 01:06 |
| Porque error? | nicoloco785 | 1068. Sum | 27 Feb 2011 21:50 | 1 |
import java.util.Scanner; public class Main { public void solucion(int num) { int aux = 0; if (num <0) { for (int i = num; i <= 1; i++) { aux += i; } } else { for (int j = num; j >= 1; j--) { aux += j; } } System.out.println(aux); } public static void main(String[] args) { Main obj = new Main(); Scanner leer = new Scanner(System.in); int numero = leer.nextInt(); if (numero < 10000) { obj.solucion(numero); } } } |
| I am wrong ?? | xiaowentao99 | 1068. Sum | 27 Feb 2011 21:25 | 2 |
#include <iostream.h> int main(){ int num; while (cin>>num){ int answer=0; if(num>=1){ answer = num*(num+1)/2; printf("%d\n",answer); } else{ answer = (2-num)*(1+num)/2; printf("%d\n",answer); } } return 0; } where ? i faced same problem. compiler may not support cin>> but istream::cin>> or u should use scanf("%d",&a); like this. thanks |
| trouble(pascal) | Vyacheslav | 1079. Maximum | 27 Feb 2011 18:53 | 2 |
what`s wrong? var n,i,res,c,max:longint; a:array[0..100000] of integer; begin repeat max:=0; Readln(n); a[0]:=0; a[1]:=1; for i:=1 to n do begin a[2*i]:=a[i]; a[2*i+1]:=a[i]+a[i+1] end; for i:=1 to n do if a[i]>max then max:=a[i]; if n<>0 then Writeln(max); until n=0; end. i find mistake: a:array[0..200001] of integer; this is accepted) |
| WHY WA#16 | Nick Loginov (USU) | 1201. Which Day Is It? | 27 Feb 2011 17:16 | 2 |
WHY WA#16 Nick Loginov (USU) 26 Mar 2010 08:44 Try to check this: 25 11 1885. The right answer is: mon........2....9...16...23...30 tue........3...10...17...24 wed........4...11...18..[25] thu........5...12...19...26 fri........6...13...20...27 sat........7...14...21...28 sun...1....8...15...22...29 Edited by author 27.02.2011 17:19 |
| Any idea where the mistake is? | Pawel Wanat | 1010. Discrete Function | 26 Feb 2011 19:10 | 5 |
This code gets WA on test 2: [code deleted] & this gets AC: [code deleted] :) Edited by moderator 02.01.2020 18:26 Try to use scanf("%I64d", &tab[i]); Oh! It's like in dev :) thx for info. . The operating system may be windows, not linux, but why it return WA instead of CE? Edited by author 27.07.2009 20:46 Cause your solution is wrong. |
| Is there any O(1) solution? | Sergey Zuev | 1017. Staircases | 26 Feb 2011 18:54 | 3 |
I know O(n^2) one. Maybe there is also an O(1)? I have an O(n*logn) one...but surely not good enough... |
| what's wrong? | Samirson | 1197. Lonesome Knight | 26 Feb 2011 16:14 | 1 |
#include <stdio.h> int main(void) { int n,k,i; char c; scanf("%d",&n); while(n--){ scanf("%1s%d",&c,&k); if((c=='a'||c=='h')&&(k==1||k==8)) {printf("2\n"); continue;} if((c=='a'||c=='h')&&(k==2||k==7)) {printf("3\n"); continue;} if((c=='b'||c=='g')&&(k==1||k==8)) {printf("3\n"); continue;} if((c=='b'||c=='g')&&(k==2||k==7)) {printf("4\n"); continue;} if(c<'b'||c>'g') {printf("4\n"); continue;} if(k<2||k>7) {printf("4\n"); continue;} if((c=='b'||c=='g') || (k==2||k==7)) {printf("6\n"); continue;} printf("8\n"); } return 0; } |
| What's wrong with my C# code? It is giving wrong answer in case # 2... | Alaska . PK | 1423. String Tale | 26 Feb 2011 00:03 | 1 |
long stringLength = Convert.ToInt32(Console.ReadLine()); string S = Console.ReadLine(); string T = Console.ReadLine(); long temp = 0; bool check = false; for (long i = 0; i < stringLength; i++) { S = S[Convert.ToInt32(stringLength) - 1] + S.Substring(0, Convert.ToInt32(stringLength) - 1); if (S == T) { temp = i + 1; check = true; break; } } if (check && temp < stringLength) Console.WriteLine(temp); else Console.WriteLine(-1);
|
| Note to the solution of the test number 3 | Alflex | 1294. Mars Satellites | 25 Feb 2011 21:49 | 1 |
The printing of the answer in C++ should be, e.g., in the form: cout << "Distance is " << setiosflags(std::ios_base::fixed) << setprecision(0) << 1000.0*sqrt(dist) << " km."; where dist is double value. You don't need to round off the answer with the help of some functions. |
| Test #1 for 1601 | Dejust | | 25 Feb 2011 17:46 | 1 |
Please give a test № 1 for the task № 1601 |
| To admins | Hakobyan Tigran (RAU) | 1005. Stone Pile | 25 Feb 2011 14:00 | 2 |
To admins Hakobyan Tigran (RAU) 9 Feb 2011 01:26 Why this solution got AC ? For the first test it outputs 15, but correct answer is 3 !!!! #include <iostream> #include <complex> #include <algorithm> #include <cmath> #include <vector> #include <string> using namespace std; int main() { int n,i,total=0,counter; int l; vector <int> x; cin>>n; for(i=0; i<n; i++) { cin>>l; x.push_back(l); } for(i=0; i<n; i++) { total+=x[i]; } counter=total/2; for(i=0; i<n; i++) { if(x[i]<=counter) { counter-=x[i]; } } cout<<2*counter+total%2; return 0; } |
| Test №4: Output limit exceeded | Vitaliy_Yurenya | 1313. Some Words about Sport | 24 Feb 2011 21:32 | 2 |
I have tested my program on many tests, and I don't see any mistakes in my algorithm. What does mean "Output limit exceeded"? Please help. Thanks. Hi. I got WA at test #4 unless I declared variables as Integer instead of 1..100. Maybe it'll help you, if you still have that error Edited by author 25.02.2011 00:00 |
| So easy ! In this website, there are many problems similar to this problem. So, it costs me no efforts to solve it ! | Phan Hoài Nam (Harvey Nash) | 1282. Game Tree | 24 Feb 2011 15:14 | 1 |
Hint for you : int travel(int player,int node) { int value; if(isLeaf(node)) return getValue(node); // If the first player is at this node, he prefer getting the maximal value among -1, 0 and +1. if(player == 0) { value = MinValue(); for(int a=0;a<numberOfChild(node);a++) { int v = travel((player+1)%2,getChild(node,a)); if(value < v) value = v; } } // Get the minimal value. else { value = MaxValue(); for(int a=0;a<numberOfChild(node);a++) { int v = travel((player+1)%2,getChild(node,a)); if(value > v) value = v; } } return value; } Edited by author 24.02.2011 15:14 |
| TLE 11 HELP PLZ !!!!!! | Nikitoz68 | 1024. Permutations | 24 Feb 2011 03:50 | 1 |
#include <cstdio> using namespace std; int main() { int const Q=1001; long long unsigned k = 0,i,n,a=0; scanf("%llu",&n); long long unsigned mas1[Q]; long long unsigned mas2[Q]; for(i = 1;i<=n;i++) { scanf("%llu",&mas1[i]); mas2[i] = mas1[i]; } for(;;) { for(i = 1;i<=n;i++) { if (i == mas2[i]){ k++;} mas2[i] = mas1[mas2[i]]; } a++; if ( k == n) { break;} else {k = 0;} } printf("%llu\n",a); return 0; } |