|
|
Common BoardI figured out this test has cuts in no more than 2 directions, but still don't understand what causes WA there. Thanks to the author for the interesting task in combinatorics and integer partitioning! [code deleted] Edited by moderator 19.11.2019 23:01 I got it. If there are two possible answer, only 1 of them should be printed. If there are two possible answer, only 1 of them should be printed. Thanks...!!! Just write 3d Fenvick Tree. And nothing more. May be you mean "exclusion & inclusion"? Pay attention to your data types, and convert before ceil if needed. (source removed after AC) Edited by author 23.01.2015 06:01 Resolved issue. Hints for those who look at this for reference. While this may not be the most elegant solution, it works. Make sure that: - Large values work. Try to imagine how many digits your solution could be composed of... - Values that may result in a legal (0-9) divisor at first, followed by a prime number... - As stated before, 0 and 1. Remember it's the LEAST positive integer... Edited by author 23.01.2015 06:00 #include<iostream> #include<vector> #include<iomanip> using namespace std; void main() { vector<double> br; double n; char c; while( (c=getchar()) != '\n') { cin >> n; br.insert(br.begin(), sqrt(n)); } for(int i = 0; i < br.size(); i++) cout << fixed << setprecision(4) << br[i] << endl;
} ".....one could pass from the pub number n to the pub with a number that divides n....." I think it should be..... ".....one could pass from the pub number n to the pub with a number that is divisible by n" otherwise it's just wrong.... Agreed, was looking if someone else had noticed. Edited by author 22.01.2015 01:28 In this task you can use stack!!!! #include <stdio.h> using namespace std
void main() { __int64 a,b,i,f=0; scanf("%i64d",&a); scanf("%i64d",&b); if( ((a % 2)==0) || ( ( b % 2)== 1)) printf("yes"); else printf("no"); } it has wa32 on c But same alghoritm on delphi has ac& program Project2; {$APPTYPE CONSOLE} uses SysUtils; var a,b:integer; begin readln(a); readln(b); if( ( ( a mod 2 )= 0 ) or ( (b mod 2) = 1) ) then write('yes') else write('no'); end. Chto za fignya? +1 WTF? Scanf can sometimes convert integers to octal. ie. 0132 Does any one have a faster code of python than this p=int(input()) plist=set() for i in range (p): a=int(input()) plist.add(a) s=int(input()) slist=[] count=0 for i in range (s): a=int(input()) if a in plist: count+=1 print (count) I've no idea how to make it faster. Got stuck myself. I TLE on test 1. What is the test 1 Thank you. Oh, there are no such cases. There is at least one healer and one attacker. Fixed in statement now. алгоритм сделал и работает, но не проходит проверку, говрит что напечатал слишком много букафф,,, мне кажется я неправильно читаю К, не знаю как перепрыгнуть через те решетки :( int K; char ch; scanf("%s%d",&ch,&K); Не могу понять что не так с 19-ым тестом... Даёт "Wrong anser" хотя я проверил каждую мелочь... кто может помочь? I had this problem too, because of a logic problem... Test: 9 2 0 0 0 0 2 0 2 0 6 0 6 0 8 0 10 6 1 2 3 4 5 6 11 3 7 8 9 Ans: 11 right 11 left 12 right 15 left 14 left 12 left 13 right 13 left 14 right Is it guaranteed that a1+a2+...+ak >= n? #include <iostream> #include <string> using namespace std; int main() { int a[1000]; int n,i,k; char Name; cin>>n; string B; k=0; for (i=0;i<n;i++){ cin>>B; Name=B[0]; if(Name=='A' or Name=='P' or Name=='O' or Name=='R') {a[i]=1;} else {if(Name=='B' or Name=='M' or Name=='S') {a[i]=2;} else {a[i]=3;}; } } k=a[0]-1;
for (i=1;i<n;i++){ if (a[i-i]<a[i]){ k=k+a[i]-a[i-1];} else { k=k+a[i-1]-a[i];}
} cout<<k; return 0;
} Thanks for the site problem, a very interesting and exciting)) Passed with PD + Segment tree. Edited by author 16.06.2012 05:41 Edited by author 16.06.2012 05:42 Yes, thanks for the problem. My solution is one sort, DP without recursion and with binary search. AC since 19th try :) So my algo is to have a vector of pairs(value and index), sort them(used usual <algorithm> sort), and then binary searched each request - first by value, and if value was correct, by index. The program ACed, on G++11 compiler with 0.921 time. when I removed the inclusion of <cstdlib>, it ACed with 0.859(and same on G++14). But funny thing is, on Visual C++ 2010, it ACed with 0.593s time, which is astounding(to me at least) because the difference is quite noticeable(25% drop). So I guess if you are getting TLE, it's worth a try to run it with Visual C++ - you might get a pass this way. Edited by author 17.01.2015 15:10 My Accepted solution #6069000 will fail if you add all permutations of test 32 as separate tests. |
|
|