|
|
Общий форумПример исходные данные результат 3 2 3 ||| - 3 бифштекса, 2 на одной сковороде || - 2 минуты | - 2 минуты итого 4 минуты, а не 3 Please read down the forum.. 12 23 13 их можно недожареные убирать потом опять ложить чтобы всегда на сковороде лежало з штуки! Подумай над этим Как? Если количество месть на сковороде 2 как ты туда одновременно положишь 3? вы че считать не умеете? how u can put third Steak if you can put only 2? Where is the Logic? А все я понял! Но все равно ты не правильно объясняешь!) А другим объяснить видимо нельзя,спасибо. Первая минута: 1 сторона 1-ого Б. , 1 сторона 2-ого Б. Вторая минута: 2 сторона 1-ого Б. , 1 сторона 3-ого Б.(первый готов) Третья минута: 2 сторона 2-ого Б. , 2 сторона 3-ого Б.(второй и третий готов) New tests were added. 123 authors lost AC after rejudge. Which is strange, since everything else is allowed in output. em test thử tren visual 2010 ra kết quả nhung khi nop len acm toan in ra cau tra loi sai without round function i got WA #14. When i used it i got AC! #include <iostream> #include <cmath> using namespace std; double round(double d); int main() {double P, Q; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cin>>P>>Q; P/=100; Q/=100; int i=2; while(true) {double min=round(i*P); double max=round(i*Q); int C=int(max); if(C>min && C<max && C>=1) break; i++; } cout<<i; return 0; } //--------------------------------------------------------------------------- double round(double d) {return floor(d*10000+0.5)/10000; } Done :) Edited by author 19.07.2011 09:10 If you get WA# 14 this test maybe help you: 2 0 1 1 0 1 1 2 1 answer: YES 1 4 2 3 First of all, it should be noted that in the literature such problem is known as "bottleneck multiple subset sum problem" (B-MSSP) and it's a variation of knapsack problem. This problem even with such restrictions is an NP-complete. So, the aproximate solution even needed. Precision??? The precision is mystic (based on statement of the problem). I don't know how other people solved this problem, but I aproximate solution through aproximation of every pair of subsets. To aproximate a pair of subsets we need to solve B-MSSP just for 2 subsets. This can be solved in O( (|S1|+|S2|)*max(Ai) ) time and O( max(Ai, |S1|+|S2|) ) space complexity. hi can you please show / send me some hint about test #2 ? (I think you can see the source code of my attempt) p519446 at yandex.ru TIA. I am learning python. When i see the example of problem 1000 and 1001, python reads from stdin. How can i read from input.txt without changing my program every time i send it in. e.g. pascal uses #ifdef online_judge to read from files In linux I prefer to use this command: xclip -out | python problem.py It takes input from clipboard and send it to script. I use Windows on my computer. When i define a function like def invoer(place): if place=='file': f = open('input.txt', 'r') regel=f.readline() print(sum(int(x) for x in regel.split(' '))) f.close() else: print(sum(int(x) for x in input().split(' '))) invoer('console') I can use a file. Is there a smarter way? hi all I'm interesting on praxis to solve tasks using java threads. Do we have here such ones ? Many thanks to author of this task and Oleg Strekalovsky [Vologda SPU] for the hint ( http://acm.timus.ru/forum/thread.aspx?id=22536&upd=634614144741133716 ). PS. It is very unexpectedly to me that some collection types (e.g. HashMap) take so much memory and CPU time in java :-/ Edited by author 19.04.2013 22:14 Edited by author 19.04.2013 22:14What the hell is test 9? In my computer I got 0.06s in worst case but still TLE 9! Write me 10 test, please ! write test 10 pls I dont know test 10.But I can help you if you give me your algo or code. I have already solved this problem. my email is ibragim.atadjanov@gmail.com First I got WA on test 10.Because my DP solution is wrong: this is AC solution: tt[0].a=tt[0].b=0; for(int i=1;i<=k;i++) { scanf("%d%d",&tt[i].a,&tt[i].b); } sort(tt,tt+k+1,cmp); memset(dp,0,sizeof(dp)); for(int i=1;i<=k;i++) { for(int j=0;j<i;j++) { if(tt[j].a<tt[i].a&&tt[j].b<tt[i].b) { dp[i]=max(dp[j]+1,dp[i]); } } }
this is WA solution for(int i=1;i<=k;i++) { scanf("%d%d",&tt[i].a,&tt[i].b); } sort(tt+1,tt+k+1,cmp); memset(dp,0,sizeof(dp)); dp[1]=1; for(int i=2;i<=k;i++) { for(int j=1;j<i;j++) { if(tt[j].a<tt[i].a&&tt[j].b<tt[i].b) { dp[i]=max(dp[j]+1,dp[i]); } } } sorry for my poor English .hope to help~ I guess there is a test case that the condition 1<=Q<=N-1 is not satisfied. I put a condition that if Q is outside the given interval then output 0 and got WA#1. Without this condition, it gives WA#8. Edited by author 18.04.2013 20:01 My programm works on my computer. Timus gives me this verdict. Why it may be?I write on C++ in Dev. May be I cannot use strings? Edited by author 16.03.2011 20:11 for string you should write #include<string> #include <iostream> #include <map> using namespace std; int main() { map<int,int> table; int x,y,sum = 3; while(sum--) { cin >> x; while(x--) { cin >> y; table[y]++; } } int s = 0; for(int i = 0;i < table.size();i++) if(table[i] == 3) s++; cout << s; return 0; } import java.util.Scanner; public class T_1226_esreveR_redrO { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String set="ABCDEFGHIJKLMNOPQRSTUVXYZWabcdefghijklmnopqrstuvxyzw"; String s =sc.nextLine(); String p=""; for (int i = 0; i < s.length(); i++) { if(set.indexOf(s.charAt(i)+"")>-1) p=s.charAt(i)+p; else{ System.out.print(p); p=""; System.out.print(s.charAt(i)); } } System.out.println(p); } } } public class T_1226 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String l = ""; char c; while (br.ready()) { char s = (char) br.read(); if ((65<=s && 90>=s)||(97<=s && 122>=s)) { l = s + l; } else { System.out.print(l + s); l = ""; } } System.out.print(l); } } My code Accepted!!! Edited by author 17.04.2013 18:28 |
|
|