| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA#3 | airlord | 1800. Закон бутерброда | 31 окт 2010 16:21 | 3 |
WA#3 airlord 30 окт 2010 14:22 can u give me some tests.. plz Re: WA#3 Victor Barinov (TNU) 30 окт 2010 14:39 Maybe you forget that L and h in cm. But g = 9.81 in m/s^2. You must use same metrics. Re: WA#3 ALexuSS[TSOGU] 31 окт 2010 16:21 400 10 15 butter 1 895 100 bread 1 894 100 butter |
| Hint | Moonstone [Samara SAU] | 1804. Пулемётчицы в плей-офф | 31 окт 2010 14:37 | 1 |
Hint Moonstone [Samara SAU] 31 окт 2010 14:37 You should add this to get AC: if (ans < 0) ans = 0; if (ans > 30) ans = 30; |
| WA#1 | kirill_SSAU619 | 1273. Шпалы | 31 окт 2010 14:25 | 1 |
WA#1 kirill_SSAU619 31 окт 2010 14:25 test 1?)) уже не надо Edited by author 31.10.2010 14:28 Edited by author 31.10.2010 14:45 I have AC!! Edited by author 31.10.2010 15:41 |
| First test | Oleg Strekalovsky [Vologda SPU] | 1804. Пулемётчицы в плей-офф | 31 окт 2010 11:06 | 4 |
First test Oleg Strekalovsky [Vologda SPU] 30 окт 2010 16:46 How Machinegunners can get a chance to advance to the next round if they will score 0 goals at next tournament? So, second team can score 30 goals and second team will win! Where is a logic? How first num from answer can be little, than second. Explain plz. In first sample if they score 0 goals they will have a chance to win, because their opponents can score less than 30 goals (for example, 0) So, Machinegunners have a chance to win in this case (of course, not 100%, but it is not necessary, read problem's condition more carefully) Ok, for example: The Machinegunners played away game, scored 0 goals, and conceded 30 goals. In this case Machinegunners team has no chances to win! If in the home game the Machinegunners will score 30 goals and concede 0 goals then they will have chances to win. |
| 250+52 | Edric Mao | 1189. Pairs of Integers | 31 окт 2010 02:45 | 2 |
250+52 Edric Mao 30 окт 2010 20:05 why this don't suitable for the sample? It is not allowed to reorder digits |
| Вопрос | Vilchevski Konstantin | 1804. Пулемётчицы в плей-офф | 30 окт 2010 21:42 | 2 |
Вопрос Vilchevski Konstantin 30 окт 2010 15:50 Что будет ответом на тест - The Machinegunners played home game, scored 0 goals, and conceded 30 goals. Спасибо. Не уверен, но если рассуждать так: при равных очках дома и в гостях и при равной сумме за два матча побеждает команда по рандому. Следовательно чтобы иметь шанс надо забить 30, но и при этом же победа не гарантируется. То есть 30 30. |
| Hint | smolcoder | 1796. Парк аттракционов | 30 окт 2010 20:31 | 1 |
Hint smolcoder 30 окт 2010 20:31 You've to delete the minimal nominal bond from total amount of money :) |
| I cant understand | Ibragim Atadjanov (Tashkent U of IT) | | 30 окт 2010 20:27 | 3 |
How did you guys solve the problem 1776 with dp Edited by author 30.10.2010 18:31 Re: aa Igor9669 30 окт 2010 17:58 Very bad... What will happend with your team if jury from NEERC in Uzbekistan will see this?? Re: aa Igor9669 30 окт 2010 20:27 To check your solutions will be so easy,task to them)) As I understand your are from the team: Tashkent U of IT 1)) |
| Algorithm (+) | Vedernikoff Sergey (HSE: АОП) | 1744. Рота Капитана | 30 окт 2010 19:04 | 6 |
Solved the problem with pure brute-force in 0.031 sec. BTW, my program works for much larger n's than in the problem statement. I'm wondering whether there is more rigorous solution? There rigorous algo exists. It has O(N^2) complexity and about 10 lines of code. My solution is not much longer - about 20 lines of code. But complexity is O(2^(N/2)*(1/2*N^2)!). But works fast for almost any N =) It means that you are very cool:D For Petrozavodsk this problem was planned as solvable by brute force and some precalculation. Just for fun. Thanks, but, probably, you could give some clue for algorithmic solution of the problem? Try to arrange soldiers in vertices of regular n-polygon and mind geometrically. |
| WA#19 | Dgut | 1800. Закон бутерброда | 30 окт 2010 17:24 | 2 |
WA#19 Dgut 30 окт 2010 14:45 What is it? solved Edited by author 30.10.2010 16:57 no.you wrong answer in test case 19 |
| WA53 | r1d1 | 1809. Чапаев и картошка | 30 окт 2010 17:18 | 1 |
WA53 r1d1 30 окт 2010 17:18 |
| Why I have Time Limit Exceeded???? c++ | h1ci | 1104. Не спрашивай даму о возрасте | 30 окт 2010 17:06 | 6 |
#include <iostream> #include <string> using namespace std; int main() { string a; long p=0,max=0,i; cin >> a; long n=a.size(); for(i=0; i<n; i++) { if(a[i]>='0' && a[i]<='9'){ p=p+(a[i]-'0'); if(a[i]-'0'>max) max=a[i]-'0'; } else { p=p+(a[i]-'A'+10); if(a[i]-'A'+10>max) max=a[i]-'A'+10;} } if(max==0) { i=0; cout << "2" << endl;} else { for(i=max+1; i<=36; i++) if(p%(i-1)==0){ cout << i << endl; break; }} if(i==37) cout << "No solution." << endl; return 0; } Because you read the whole string to a variable, and then loop through that string. You must use C. It's more quick . No C++. Just C. In the statements, string_length = 10^6, but your string_size can be maximum 256, write like this, and you will get AC : #include <iostream> #include <string> using namespace std; string a; long p,maxx,i,n; int main() { cin >> a; n=a.size(); for(i=0; i<n; i++) { if(a[i]>='0' && a[i]<='9'){ p=p+(a[i]-'0'); if(a[i]-'0'>maxx) maxx=a[i]-'0'; } else { p=p+(a[i]-'A'+10); if(a[i]-'A'+10>maxx) maxx=a[i]-'A'+10;} } if(maxx==0) { i=0; cout << "2" << endl;} else { for(i=maxx+1; i<=36; i++) if(p%(i-1)==0){ cout << i << endl; break; }} if(i==37) cout << "No solution." << endl; return 0; } No need to use complicated input styles. Just include cstdio as a header file and use scanf instead. You dont need to switch over to a C file. You can simply use C functions from C++. Regards Nitin 2 change code and AC:-) /* #include <iostream> #include <string> using namespace std; int main() { string a; long p=0,max=0,i; while(cin >> a)//1 { p=0;max=0;//2 long n=a.size(); for(i=0; i<n; i++) { if(a[i]>='0' && a[i]<='9'){ p=p+(a[i]-'0'); if(a[i]-'0'>max) max=a[i]-'0'; } else { p=p+(a[i]-'A'+10); if(a[i]-'A'+10>max) max=a[i]-'A'+10;} } if(max==0) { i=0; cout << "2" << endl;} else { for(i=max+1; i<=36; i++) if(p%(i-1)==0){ cout << i << endl; break; }} if(i==37) cout << "No solution." << endl; } return 0; } */ |
| Wrong answer 6 | DNS | 1070. Местное время | 30 окт 2010 17:05 | 3 |
If you got Wrong answer 6 then if (answer>5) answer=5; cout<<answer -- !!! Most Important!!! I have got AC when write it. Example 01.01 21.59 04.23 11.22 Answer: 5 true 7 hours (21-7=7+7), but you must write 5!!! good luck. :) I think you are not right. In this test the time difference between two airports is exaclty 5, and the flying lasts 2 hours. So, the first difference ~ -3 hours, and the second one ~ 7 hours. It's true)) There is a inconsistent problem situation. They should write date of flight. Sorry for my english. |
| No subject | B-S42#-1Shipulin | 1804. Пулемётчицы в плей-офф | 30 окт 2010 13:16 | 1 |
Edited by author 02.11.2010 21:17 |
| why I always got WA on test #2? | ss | 1086. Криптография | 30 окт 2010 03:43 | 8 |
I just find all 15000 prime numbers and put them in an array then writeln(a[n]) for each n isn't it correct? I just cannot understand Maybe you generate only small numbers, try to use array size 170001, and you'll get AC! I set 190000.some problem. where is the problem???this code fails in test#2 :( #include<stdio.h> #define size 150001 long a[size]; long p[size]; int main() { long i,j,k,m=0,n,t; a[0]=1; a[1]=1;
for(i=4;i<=size;i+=2) a[i]=1; for(i=3;i<=size;i+=2) { if(a[i]==0) { k=size/i; for(j=i;j<=k;j++) a[j*i]=1; } }
for(i=0;i<=size;i++){ if(a[i]==0) p[m++]=i; }
scanf("%ld",&t); while(t--){ scanf("%ld",&n); printf("%ld\n",p[n-1]); } return 0; } Use __in64 instead of long! you user java language for this problem first generate prime number and put it into a array prime[15000] and the scan the number ex. 10 and print prime[10] There is my i got AC import java.util.*; public class Main { public static long prm[] = new long[15001]; public static void main( String args[] ) {
Main obj = new Main(); obj.sieve(163841); Scanner in = new Scanner(System.in); int t=in.nextInt(); while(t>0) { t--; int n=in.nextInt(); System.out.println(prm[n]); } } public void sieve (int outerBounds) { long start = System.currentTimeMillis();
int N = outerBounds; boolean[] isPrime = new boolean[N + 1]; for (int i = 2; i <= N; i++) { isPrime[i] = true; } for (int i = 2; i*i <= N; i++) { if (isPrime[i]) { for (int j = i; i*j <= N; j++) { isPrime[i*j] = false; } } } int j=1; for (int i = 2; i <= N; i++) { if (isPrime[i]) { prm[j]=i; j++; } } } } here i user sieve method Edited by author 30.10.2010 03:44 Edited by author 30.10.2010 03:45 |
| what is the first data? | tklist | 1030. Титаник | 29 окт 2010 21:28 | 1 |
I aways WA,but I cannot find the error.Can someone help me? |
| if you had WA 5 | Sxcyd | 1212. Морской бой | 29 окт 2010 07:44 | 1 |
A very important problem that you may forgot.When you calculate the sum of the ship could placed,if we Sum:=(n-k+1)*m+(m-k+1)*n. It's wrong,because k may >n&m. There is a test: 6 2 1 1 1 2 H 4 You should output 2. Good Luck! |
| HELP WITH IDEA!!! | Nurbek_[KTMU MANAS] | 1605. Дьявольская последовательность | 29 окт 2010 05:38 | 11 |
Who has accepted this task, please help with idea. I have not anithing idea! Use log10 to compare 2^n and 10^k 2 svr: I don't understand what you mean ? What I should use formule or ...? This sequence representable in the form of partial sums apparent number, the amount of which is equal to 1 / 6 - to find the desired response should compare the full amount of partial, asked n. only math. -- по-русски: эта последовательность представима в виде частичных сумм очевидного ряда, сумма которого равна 2/3 - чтобы найти искомый ответ необходимо сравнить всю сумму с частичной, задаваемой n. чистая математика. I've accepted this problem using precalc. Just quick long arithmetics and some trick to make source file of size 4 Kb... I meant the formula a[n]=2/3+(-1)^(n-1)/(3*2^(n-1)) to svr: you are right, this formula is correct (I can prove it). But how to take benefit from this? Of course, using this this formula I can right brute force quick long arithmetics. But this algo will be TL. we should take log10 from abs(2/3-a[n]) ?? use also the formula: 2/3=0.666666+10^(-k)*2/3 I think problem is very interesting. I was trying to solve it in "programming way" for a long time, but all my attempts lead to TL on N > 10000 values. Finally I finished with completely mathematical solution. I think that description from my source can help someone so I'll left it here... /* * Let x[n] be n-th element of given sequence. * Following formula for x[n] can be simply proved: * x[n] = 2/3 + (1/3)/(2^(n-1)) if n - odd * x[n] = 2/3 - (1/3)/(2^(n-1)) if n - even * Let delta = (1/3)/(2^(n-1)) = 0.000XXXX.. (X - any digit) * We can simply find number of leading zeroes after * decimal point (befor XXX..) as: * k = floor[ Log10(3*2^(n-1)) ] or * k = floor[ Log10(3) + (n-1)*Log10(2) ] * Obviously answer always will be k or k-1. * Consider (k-1)-cases: * [1] N - odd (add delta): * A = (1/3)/(10^k) = 0.0003333... (repeat 0 k times) * If A <= delta - then addition will affect k-th digit * and answer will be k-1. * [2] N - even (subtract delta): * A = (2/3)/(10^k) = 0.0006666... (repeat 0 k times) * If A <= delta - then subtraction will affect k-th digit * and answer will be k-1. * Compare logarithms instead of comparing values themself. */ |
| Wrong link in notification letter | Fyodor Menshikov | | 28 окт 2010 22:29 | 2 |
I've received letter from judge@acm.timus.ru containing the following text: " ID: 2336619 Problem: 1604. Country of Fools Wrong verdict: Accepted New verdict: Wrong answer http://acm.timus.ru/status.aspx?space=1&num=1604&author=" I think after author and '=' there should be my author id. But it's missing. And I cannot see list of my submissions, instead I see list of recent submissions of the problem solutions. Fixed Vladimir Yakovlev (USU) 28 окт 2010 22:29 |
| WA9 | Andrex | 1711. Кодовые имена | 28 окт 2010 18:22 | 1 |
WA9 Andrex 28 окт 2010 18:22 please, help me... my code: #include <iostream> using namespace std; int main() { int n,m[16],k; char c[48][20],v[16][20],ch[3][20]; cin>>n; for(int i=0;i<n*3;i++) cin>>c[i]; for(int i=0;i<n;i++) { cin>>k; m[i]=k; } k=(m[0]-1)*3; if((strcmp(c[k],c[k+1])<=0)&&(strcmp(c[k],c[k+2])<=0)){strcpy(v[0],c[k]);} if((strcmp(c[k+1],c[k])<=0)&&(strcmp(c[k+1],c[k+2])<=0)){strcpy(v[0],c[k+1]);} if((strcmp(c[k+1],c[k])<=0)&&(strcmp(c[k+1],c[k+2])<=0)){strcpy(v[0],c[k+1]);} for(int i=1;i<n;i++) { k=(m[i]-1)*3; if((strcmp(c[k],c[k+1])<=0)&&(strcmp(c[k],c[k+2])<=0)) { strcpy(ch[0],c[k]); if(strcmp(c[k+1],c[k+2])<=0) { strcpy(ch[1],c[k+1]); strcpy(ch[2],c[k+2]); } else { strcpy(ch[2],c[k+1]); strcpy(ch[1],c[k+2]); } }
if((strcmp(c[k+1],c[k])<=0)&&(strcmp(c[k+1],c[k+2])<=0)) { strcpy(ch[0],c[k+1]); if(strcmp(c[k],c[k+2])<=0) { strcpy(ch[1],c[k]); strcpy(ch[2],c[k+2]); } else { strcpy(ch[2],c[k]); strcpy(ch[1],c[k+2]); } }
if((strcmp(c[k+2],c[k])<=0)&&(strcmp(c[k+2],c[k+1])<=0)) { strcpy(ch[0],c[k+2]); if(strcmp(c[k],c[k+1])<=0) { strcpy(ch[1],c[k]); strcpy(ch[2],c[k+1]); } else { strcpy(ch[2],c[k]); strcpy(ch[1],c[k+1]); } }
if(strcmp(v[i-1],ch[0])<=0) { strcpy(v[i],ch[0]); } else { if(strcmp(v[i-1],ch[1])<=0) { strcpy(v[i],ch[1]); } else { if(strcmp(v[i-1],ch[2])<=0) { strcpy(v[i],ch[2]); } else { cout<<"IMPOSSIBLE"; return 0; } } } } for(int i=0;i<n;i++) { cout<<v[i]<<endl; } return 0; } |