Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | WA4 | German | 1457. Теплотрасса | 3 ноя 2016 21:08 | 1 | WA4 German 3 ноя 2016 21:08 If you have WA4 java. Put 10^7 instead of 10^6 | | Why WA 7 | mythysjh | 1837. Число Исенбаева | 2 ноя 2016 15:07 | 5 | Edited by author 30.09.2013 09:17 Edited by author 30.09.2013 09:17 ___Test 13 Fominykh Isenbaev BBB BBB CCC AAA Ayzenshteyn Oparin Samsonov Ayzenshteyn Chevdar Samsonov Dublennykh Fominykh Ivankov Burmistrov Dublennykh Kurpilyanskiy Cormen Leiserson Rivest Oparin AA AAA Isenbaev Oparin Toropov AA DD PP PP QQ RR RR SS TT TT Toropov Oparin ____correct answer: AA 2 AAA 2 Ayzenshteyn 2 BBB 1 Burmistrov 3 CCC 2 Chevdar 3 Cormen undefined DD 3 Dublennykh 2 Fominykh 1 Isenbaev 0 Ivankov 2 Kurpilyanskiy 3 Leiserson undefined Oparin 1 PP 3 QQ 4 RR 3 Rivest undefined SS 3 Samsonov 2 TT 2 Toropov 1 Other lexicographical order is correct also: AA 2 AAA 2 Ayzenshteyn 2 BBB 1 Burmistrov 3 CCC 2 Chevdar 3 Cormen undefined DD 3 Dublennykh 2 Fominykh 1 Isenbaev 0 Ivankov 2 Kurpilyanskiy 3 Leiserson undefined Oparin 1 PP 3 QQ 4 Rivest undefined RR 3 Samsonov 2 SS 3 Toropov 1 TT 2 You can see that Rivest undefined RR 3 Samsonov 2 SS 3 Toropov 1 TT 2 are ordered in other lexicographical order. You're wrong. Problem says: "The first letter of a name is capital and the other letters are lowercase", so tests can't contain names like these "RR, TT, AAA, etc.". 7 7 Isesnbaev Oparin Toropov Ayzenshteyn Oparin Samsonov Ayzenshteyn Chevdar Samsonov Fominykh Isesnbaev Oparin Dublennykh Fominykh Ivankov Burmistrov Dublennykh Kurpilyanskiy Cormen Leiserson Isenbaev test this case | | Java solution | Mortrus | 1220. Stacks | 31 окт 2016 23:22 | 1 | Didn't notice that problem is not for Java, so I solved it. Maybe someone will need the solution. Solution without checking of stacks for emptiness. import java.util.ArrayList; import java.util.HashMap; import java.util.Scanner; import java.util.StringTokenizer; public class HelloWorld { public static void main (String[] args) { HashMap<Integer, ArrayList<Integer>> map = new HashMap<Integer, ArrayList<Integer>>(); Scanner reader = new Scanner(System.in); int n = reader.nextInt(); reader.nextLine(); for (int i = 0; i < n; i++) { String command = reader.nextLine(); StringTokenizer tokenizer = new StringTokenizer(command); command = tokenizer.nextToken(); if ("PUSH".equals(command)) { int key = Integer.parseInt(tokenizer.nextToken()); int value = Integer.parseInt(tokenizer.nextToken()); if (map.containsKey(key)) { map.get(key).add(0, value); } else { map.put(key, new ArrayList<Integer>()); map.get(key).add(0, value); } } else if ("POP".equals(command)) { int key = Integer.parseInt(tokenizer.nextToken()); if (map.containsKey(key)) { System.out.println(map.get(key).get(0)); map.get(key).remove(0); } } } } } Edited by author 31.10.2016 23:24 Edited by author 31.10.2016 23:26 | | test 6: Runtime error (access violation), what can it be? | Abram_TA | 1971. Настройки графики | 31 окт 2016 17:27 | 3 | Here is my not accepted solution: #include<iostream> #include<string> using namespace std; double P(int power[],string names[],int a,int n,int video_power,int on_or_off[],int w,int h){ a=video_power; for(int i=0;i<n;i++){if(on_or_off[i]==1){a/=power[i];}} double res=a/(w*h); return res; }
int main() { int n; cin>>n; string * names = new string[n]; int * power = new int[n]; for (int i=0;i<n;i++){ cin>>names[i]; cin>>power[i]; } int w,h,video_power; cin>>w>>h>>video_power; double results[100]; int on_or_off[100]; for(int i=0;i<n;i++){on_or_off[i]=1;} int e=0; int a=video_power; for (int i=0; i<n;i++){ a/=power[i]; } double prodyctivity=a/(w*h); results[e]=prodyctivity;e++; int m; cin>>m; for(int i=0; i<m; i++){ string change,change_name; cin>>change; if(change[0]!='R'){ cin>>change_name; for(int y=0;y<n;y++){ if(change=="On" && change_name==names[y]){ on_or_off[y]=1; prodyctivity=P(power,names,a,n,video_power,on_or_off,w,h); results[e]=prodyctivity;e++; } else if(change=="Off" && change_name==names[y]){ on_or_off[y]=0; prodyctivity=P(power,names,a,n,video_power,on_or_off,w,h); results[e]=prodyctivity;e++; } } } else{ int a1,a2; cin>>a1>>a2; w=a1;h=a2; prodyctivity=P(power,names,a,n,video_power,on_or_off,w,h); results[e]=prodyctivity;e++; } } for(int i=0;i<m+1;i++){ if(results[i]<10){cout<<"Slideshow"<<endl;} else if(results[i]>=60){cout<<"Perfect"<<endl;} else{cout<<"So-so"<<endl;} } } Please! I dont know where your mistake is, but anyway this solution is wrong. Check the max test case: n = 99999 and each option is 100 (100^99999). Your double precision not enough for AC. It's 100000 results, not 100 results, hence the access violation on your tiny array | | If you want to know why when gcd(M, N) = 1 Ans is M + N - 1, come in! | Huang WenHao | 1139. Городские кварталы | 30 окт 2016 22:52 | 3 | If the plane fly across a edge and it will produce a point then produce a new block so the answer add one. If gcd(M, N) = 1, it means there is no situation that the plane fly across the crossroads. See from left to right it produce M point and see from north to south it produce N point, but one is calculate twice, so there are M + N - 1 points and Ans is M + N - 1. and what if gcd(m,n)!= 1 ?? Sorry, can't get you and what if gcd(m,n)!= 1 ?? Sorry, can't get you Reduce to smaller problem (m / gcd(m,n), n / gcd(m,n)) and then use it to solve the original problem. | | can you tell me how to solve this question | xinxin | 1139. Городские кварталы | 30 окт 2016 22:41 | 2 | | | Input not closing | Kevin | 1001. Обратный корень | 30 окт 2016 22:25 | 2 | I've perused over some of the other solutions here, tried to come up with something original, but I'm having a difficult time understanding why it won't stop letting me input in Eclipse, and how to deal with that...Here's my code: import java.util.*; public class ReverseRoot {//start class public static void main(String[] args) {//start main Scanner in = new Scanner(System.in); ArrayList<Long> array = new ArrayList<Long>(); array.add(in.nextLong());
while(in.hasNextLong()) { array.add(in.nextLong()); } in.close();
for (int i = array.size(); i > 0; i--) System.out.printf("%.4f%n", Math.sqrt((double)array.get(i))); }//end main }//end class Try to run program from command line: java Solution < 1.txt And 1.txt contains list of numbers, like below: 1 2 3 Edited by author 30.10.2016 22:25 | | Hint, very easy | http://www.HelloACM.com | 2005. Такси для программистов | 30 окт 2016 17:49 | 3 | s1 = ['1 2 3 4 5', '1 4 3 2 5', '1 3 2 4 5', '1 3 4 2 5'] [deleted] Edited by author 24.06.2014 02:43 int order[3] = {2, 3, 4}; do { if (order[2] == 3) continue; calculate_distance(); } while (next_permutation(order, order + 3); | | how about use recursion | staticor | 1224. Спираль | 30 окт 2016 17:24 | 2 | think about : F(N,M) = F(N-? , M- ? ) and give the initial values. The number of steps is too big. By doing a single recursive step you reduce the size of the original problem to (N - 2, M - 2). If we were to reduce the size to (N / 2, M / 2) (notice that we changed minus sign to division), then we could solve it recursively. Instead you should think of this problem as a whole. There are N rows and M columns. So some part of the robots path is by row and some part is by column: path = row|column|row|column|row|column... And we are counting the number of signs | in the path. As we see, each column is surrounded by sign | from both of its sides: "|column|". The first rough estimate that comes to mind after this observation is that probably the robot does 2 * (number of columns) turns. And by thinking of different specific cases of (N, M) we can turn this estimate into a true measure of the number of turns of the robot in the general case. Edited by author 30.10.2016 17:25 | | : please help me why it is wrong | xinxin | 1224. Спираль | 30 окт 2016 16:22 | 2 | #include<stdio.h> #include<string.h> int f(int n,int m) { if(n==1||m==1) return 0; if(n==2&&m>1) return 2; if(n==3&&m==2) return 3; if(m>2&&n>2) return f(n-2,m-2)+4; } int main() { int n,m; scanf("%d %d",&n,&m); printf("%d",f(n,m)); fflush(stdin); getchar(); return 0; } Input "N=1 M=1" doesn't give you zero. | | Problem 1311 Stable Construction has been changed | Vladimir Yakovlev (USU) | 1311. Устойчивая конструкция | 30 окт 2016 16:01 | 1 | * The minimal height of the wall is set to 1 (previously 0). * The total number of bricks is set to be between 1 and 100 000 (previously, not more than 1 000 000, but there were no such tests). * New tests have been added. * All accepted solution have been rejudged, 98 authors have lost their AC. | | Please help I am getting runtime error in java 1.8 | Kandarp | 1837. Число Исенбаева | 30 окт 2016 11:08 | 2 | [code deleted] Edited by moderator 19.11.2019 23:13 check 1 a aa aaa answer a undefined aa undefined aaa undefined | | First number? | monsky | 1003. Чётность | 29 окт 2016 23:46 | 1 | It looks as first input number (sequence length) isn't needed for solution. | | I CAN HELP | Mixael | 1197. Один в поле воин | 29 окт 2016 21:27 | 1 | int a[10]={-1,1,2,2,1,-1,-2,-2,-1,1}; ... for(i=1;i<=8;i++) if(x+a[i-1]>0 && x+a[i-1]<9 && y+a[i+1]>0 && y+a[i+1]<9) h++; DO IT!!! :) | | What's wrong my algo? I got WA2, always. | xurshid_n | 2059. Не общие подпалиндромы | 28 окт 2016 04:34 | 1 | Let C = A + '$*&' + B for string C build Palindrom Tree. calculate frequency of each palindrom : f(A,p) calculate frequency of each palindrom : f(B,p) x = count(f(A,p)>f(B,p)) y = count(f(A,p)==f(B,p) && f(A,p)!=0) z = count(f(A,p)<f(B,p)) //little code: freq[i][0] ---> f(A,p); freq[i][1] --> f(B,p). for(int i = 0; i < a.size(); ++i){ add_letter(a[i]); freq[last][0]++;} add_letter('$'); add_letter('*'); add_letter('&'); for(int i = 0; i < b.size(); ++i){ add_letter(b[i]); freq[last][1]++;} for(int z = sz-1; z > 0; z--){ v = link[z]; freq[v][0] += freq[i][0]; freq[v][1] += freq[i][1]; } int x=0,y=0,z=0; for(int i = 2; i< sz; ++i)// skip roots { x += (bool)(freq[i][0] > freq[i][1]); y += (bool)(freq[i][0] == freq[i][1] && freq[i][0] !=0); z += (bool)(freq[i][0] < freq[i][1]); } | | WA test 10 C++ | TIU_Sarexer | 1083. Факториалы!!! | 26 окт 2016 21:47 | 1 | #include <iostream> #include <string> using namespace std; int main() { int num, res; string c, b = "!", a = "!"; cin >> num >> c; res = num; int sign = 0; for (int i = 1; b <= c; i++) { b = b + a; sign = i; } if (num%sign != 0) { for (int i = 1; i*sign < num; i++) { res = res * (num - i*sign); } res = res *(num%sign); } else { for (int i = 1; i*sign < num; i++) { res = res * (num - i*sign); } } cout << res; return 0; } | | Why task score is so different with #1203 Scientific Conference? | ToadMonster | 1112. Покрытие | 26 окт 2016 20:59 | 1 | Solved both tasks with the same algorithm. Think this task is over-valued. Edited by author 26.10.2016 20:59 | | TLE | beka | 1846. НОД 2010 | 26 окт 2016 16:28 | 1 | TLE beka 26 окт 2016 16:28 just submitted code and got TLE on 15test, submitted same code after few minutes and got accepted. submitted again and got TLE on 24test for same code. | | Time Limited | Shohruh_1999 | 1209. 1, 10, 100, 1000... | 26 окт 2016 14:33 | 1 | | | Problem 1992 CVS has been rejudged | Vladimir Yakovlev (USU) | 1992. CVS | 25 окт 2016 17:41 | 3 | All solutions have been rejudged with the current time limit. Also, few more tests have been added. 10 authors have got AC while 23 other have lost. I have replaced standart C# input functions with my low level parse method and got Accepted. Is this the goal of that rejudgement? Well, I just resubmitted the previous solution with visual c++. I do every query O(1) operations and use scanf and printf. I think the version of your g++ compiler is not that good. There were some troubles with scanf and printf at some new versions of g++ compiler. |
|
|