Общий форумCan someone please tell how the test looks like? Don't forget about saving MIN PRICE of device Edited by author 31.03.2017 17:39 When i write my program like: #include<cstdio> long long int i,k; int main(){ scanf("%lld",&k); i=k / 3; while(k % i!=0){ i=k /(k / i +1); } i got AC,but when i change it to: #include<cstdio> int main(){ long long int i,k; scanf("%lld",&k); i=k / 3; while(k % i!=0){ i=k /(k / i +1); } printf("%lld",(k / i-1)); } printf("%lld",(k / i-1)); } i got WA5...does anyoe know how is that possible? wtf i=k / 3; ?? If k%(l+1)==0 then 2nd have a chance to win. And 1st wins if k%(l+1)!=0 try it: for (l=3;k%l!=0;l++);; Edited by author 31.03.2017 14:34 Check your program for very big K. It helped me. Edited by author 31.03.2017 14:38 I got AC on this simply by guessing that combining the stripies from the largest down to the smallest would result in the smallest colony size. Can someone explain what mathematical or logical reasoning would be used to arrive at this conclusion, or prove that this conclusion would be true? I guessed the same and also I want to know mathematical proof The factor 2 does not matter -- you will always find one 2 which was sqrt'ed (n-1) times, ..., one 2 not sqrt'ed. OOH, there will be exactly two given number which got sqrt'ed (n-1) times, ..., one given number that got sqrt'ed once. Therefore, you will want larger numbers be sqrt'ed more times. Edited by author 22.03.2016 12:08 I can explain Okay, we have sequence m1,m2,m3,m4.... of weights in input But now imagine that we have a heap of stripies with their weights. Our answer (for example n=4) will be: 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) for greater understanding write it on a sheet. So we need to maximize it but we don't know order of m1,m2,m3,... which give max answer. It's clear that if 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) should be maximum then m1*2*sqrt(m2*2*sqrt(m3*m4)) (in sqrt) should be maximum too. Reasoning in this way we understand that we need m3*m4 be maximum. So this sequence should be sorted in this way: m4>=m3>=m2>=m1 I hope my English is enough to explain it)))) Edited by author 31.03.2017 19:50 Don't forget that not only P should be divider of 2N but P+2A-1 should be divider of 2N too. It was my mistake when I got WA 7 In fact, the string are two apostrophe symbols, and the template are an underline and an apostrophe symbol. An underline can match any single character, and the other apostrophe can match the second apostrophe. So, the answer is 'YES'. #include <iostream> using namespace std; int main() { long N; cin >> N; long **array = new long*[N]; for (long i = 0; i < N; i++) { array[i] = new long[2]; long temp, temp2; cin >> temp >> temp2; array[i][0] = temp; array[i][1] = temp2; } cout << endl << endl;
long l, r, i, k, buf; k = l = 0; r = N - 2; while (l <= r) { for (i = l; i <= r; i++) if (array[i][1] < array[i + 1][1]) { swap(array[i], array[i + 1]); k = i; } r = k - 1; for (i = r; i >= l; i--) if (array[i][1] < array[i + 1][1]) { swap(array[i], array[i + 1]); k = i; } l = k + 1; } for (long i = 0; i < N; i++) { cout << array[i][0] << " " << array[i][1] << endl; } return 0; } What is wrong with it?( I use bubbleshaker sort. You shouldn't use bubble sort. You the only should receive the same sort result. my program with while(n < 3) printf("there are some stupid tests!\n"); gets Output limit exceeded 3. Please, check your tests! There is some trash in the end of a file in test 3. So, my multitest found it) can you elaborate on this? czu i'm getting WA on test4. would it have to do with this? I don't understand. I use quicksort and then find solution very fast. MLE #21 say me that memory limit! I use c#. Edited by author 26.03.2017 21:16 Edited by author 26.03.2017 21:16 Edited by author 26.03.2017 21:17 Edited by author 26.03.2017 21:37 AND i use List MLE - your program spent too much memory. No perfomance problem detected. Looks like you read all N inputs into list. Try using dictionary K -> count. I use Dictionary and get MLE too. I think problem in input data. I enter input data like: string[] input = Console.In.ReadToEnd().Split( new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); And add in dictionary for (int i = 0; i < input.Length; i++){ ... } I don't understand what's wrong :( Was wrong. Dictionary => TLE. Got input into List, sorted List, took middle one => AC. Just avoid reading whole input. Use something like static int readInt() { return Int.Parse(Console.ReadLine()); } Thanks! I read data like: static int readInt() { return Int.Parse(Console.ReadLine()); } But ... I have WA #25.. I think, i do all rigth, but i've WA1=(( I don't understand output type, that's mean what me should to print. Sorry for my English... var a,b:array[1..15000]of longint; asd,asd1,n,i,j:longint; begin read(n); for i:=1 to n do read(a[i],b[i]); for i:=1 to n-1 do for j:=i+1 to n do if b[i]<b[j] then begin asd:=b[i]; b[i]:=b[j]; b[j]:=asd; asd1:=a[i]; a[i]:=a[j]; a[j]:=asd1; end; for i:=1 to n do begin write(a[i],' ',b[i]);writeln;end; end. Ou fuck, i've do sort dont rigth.... Ou fuck, i've do sort dont rigth.... I think your solution will be TL. Use merge, or another fast sort I think that you answered two years later than it was necessary :) //problem solved (issue of different compilers of my local PC and judge one) Edited by author 26.03.2017 16:41 //tower.in 1000 60 10 1 2 3 4 5 20170312 666666666 888888888 999999999 427749136024120470 427749136024120471 427749136024120472 -1 //tower.out 427749136024120472 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 4 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 4 5 6 7 6 7 6 7 8 9 8 7 6 5 6 7 8 9 10 9 8 9 10 11 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 4 3 4 3 4 5 6 7 8 9 8 9 10 11 12 11 10 9 10 9 10 9 10 9 8 9 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 2 3 4 5 6 5 4 5 6 5 4 3 4 5 6 7 8 9 10 9 8 9 8 7 6 7 6 5 4 5 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 4 3 4 5 4 5 6 7 8 9 10 9 8 7 8 9 8 9 10 9 8 9 10 11 12 11 12 13 14 13 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 7 6 5 4 3 2 1 2 3 2 1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 7 6 5 4 3 2 3 2 1 2 1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 8 7 6 5 4 3 2 1 2 1 2 1 I finished it in 0.015s. The solutions were judged in a low performance mode for the last two weeks. Now it's fixed, the solutions are being rejudged. Remember that you shouldn't check prime numbers (They call an integer satisfying if they both consider or do not consider this integer to be interesting) GET BIGER HASH NUM !!!! If your hash number isn't big enough, you will end up with an endless loop. hell why WA1? i wanna get my TLE package main import ( "bufio" "os" "strings" "strconv" ) func main() { in := bufio.NewReader(os.Stdin) out := bufio.NewWriter(os.Stdout) buffer, _ := in.ReadString('\n') str := []rune(strings.Trim(buffer, "\n")) buffer, _ = in.ReadString('\n') count, _ := strconv.ParseUint(strings.Trim(buffer, "\n"), 10, 0) for k := uint64(0); k < count; k++ { buffer, _ = in.ReadString('\n') flds := strings.Fields(buffer) if []rune(flds[0])[0] == 'c' { i, _ := strconv.Atoi(flds[1]) str[i-1] = []rune(flds[2])[0] } else { i, _ := strconv.ParseUint(flds[1], 10, 0) j, _ := strconv.ParseUint(flds[2], 10, 0) if isPali(i-1, j-1, str) { out.WriteString("Yes\n") } else { out.WriteString("No\n") } } } out.Flush() } func isPali(i, j uint64, str []rune) bool { for i < j { if str[i] != str[j] { return false } i++ j-- } return true } Edited by author 22.03.2017 08:19 Edited by author 22.03.2017 08:19 |
|