| Show all threads Hide all threads Show all messages Hide all messages |
| What's wrong with it?I am getting WA. | Ram Prakash P | 1020. Rope | 8 Dec 2016 19:54 | 2 |
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { int i,j,N,p; std::cin>>N; float cd[N][2],R,dist = 0.0; std::cin>>R;
for(p = 0;p < N;p++) std::cin>>cd[p][0]>>cd[p][1];
i = 0; j = i + 1;
dist = (2 * std::acos(-1.0) * R); while(i < N) { dist += std::sqrt( ( (cd[j][0] - cd[i][0]) * (cd[j][0] - cd[i][0]) ) + ( (cd[j][1] - cd[i][1]) * (cd[j][1] - cd[i][1]) ) ); i++; j = (i + 1) % N; }
std::cout <<std::setprecision(2) << std::fixed <<dist; return 0; } |
| Correct answer? | szczepi | 2105. Alice and Bob are on Bikes | 8 Dec 2016 19:27 | 2 |
What answer should be for given test? 1 1 1 1 0 |
| Sample explanation | Foobar | 1781. Clean Code | 8 Dec 2016 15:29 | 4 |
Can anyone explain the sample: 3 0 0 0 1 1 0 1 1 0
1 1 3 I dont understand it. The resulting matrix is: 0 1 1 0 1 1 0 0 0 Thanks! I think the correct final matrix must have all 1(s) above or lie on the main diagonal. Any hint to solve this problem ? Edit: nvm, solved it, nice problem with simple algorithm :D Edited by author 12.10.2010 11:07 Edited by author 12.10.2010 11:07 This problem very similar with 1042- central heating Each move (i,j) make switching (and replacing) of some set of pairs of cells. Thus we have linear system over field {0,1) No, the solution is much simplier. You just need to investigate the properties such an operation has. Edited by author 08.12.2016 15:31 |
| Use 'Visual C++ 2013' instead of 'G++ 4.9 C++11' | 🎧 Vadim Barinov \Frez_Fstilus/'``' :) | 1198. Jobbery | 7 Dec 2016 21:29 | 1 |
Same solution: Visual C++ 2013: Accepted 0.686 8 120 КБ G++ 4.9 C++11: Time limit exceeded 21 1.513 3 924 КБ oh my code.. |
| I have some thought on this problem: | Shen Yang | 1399. Economical Director | 7 Dec 2016 14:25 | 1 |
first use dynamic programming to find the minimum value of distance from 0 and visit 1~m once then to 0, we can get a chain 0--i1-i2--...-im--0 then we consider to cut this chain, use dynameic programming dp[i] to record distance.we cut first i node of the chain.. dp[m] is the result.. I'll try this idea... |
| C++ ac,G++ TLE | Shen Yang | 1626. Interfering Segment | 7 Dec 2016 12:26 | 3 |
judgement is not stable,sometimes submit AC sometimes submit TLE... 800*800*400 random can AC |
| what is test number 2? | tantai1993 | 1086. Cryptography | 7 Dec 2016 10:04 | 2 |
can someone explain test number 2? |
| does anybody have java solution for this task? | Михаил Аршинов | 1732. Ministry of Truth | 7 Dec 2016 06:13 | 2 |
please post it (read chunk) here or give some piece of code, many sanx! java AC 0.171 dont use String.toCharArray btw WA7 (add line 2): 1. for (i=p; i<lena; i++) 2. if (a[i]==' ') out2.print(' '); else 3. out2.print('_'); ab ab abcabcabcd | a b bcd | a_ _b _______bcd | so WA 7 controverses with "The words in both utterances are separated with exactly one space; there are no leading or trailing spaces in each line." Edited by author 07.12.2016 06:15 |
| На тестовых входных данных вроде всё ок. Но выдаёт Wrong Answer. Почему? | ivanbelousov | 1001. Reverse Root | 6 Dec 2016 18:12 | 2 |
#include <stdio.h> #include <math.h> int main( int argc, char ** argv ) { unsigned long number[256*1024]; int counter = 0; while( scanf("%lu",&number[counter]) != EOF ) { counter++; }
for( counter--; counter >= 0; counter-- ) printf("%.4f\n",sqrt(number[counter])); return 0; } |
| how to get ac in 0.031 sec? | Radi Muhammad Reza | 1742. Team building | 6 Dec 2016 15:06 | 4 |
i just found no of storngly connected components and got ac in 0.562 sec after eliminating stack overflow with pragma. how to make it so fast as 0.031 sec and so little memory? You don't have to find strongly connected components. You can just sort vertices topologically and here you will find an answer :) But for topological sorting, graph must be DAG(directed acyclic)? i just keep getting stack overflow,could you please tell me how to eliminate it? |
| If you have WA10 | gepardo | 2092. Bolero | 6 Dec 2016 10:22 | 1 |
Try this test: Input: 5 1 100 0 100 0 100 0 100 0 100 0 2 50 Output: 250 |
| WA 22 | Combatcook [YarSU] 🐸 | 1513. Lemon Tale | 4 Dec 2016 20:24 | 3 |
WA 22 Combatcook [YarSU] 🐸 4 Dec 2016 14:13 Hello! I have strange WA 22 and really don't understand why. Can anyone help to find the bug in my code. (corrected) Edited by author 04.12.2016 20:25 Re: WA 22 Jane Soboleva (SumNU) 4 Dec 2016 15:48 Your answer to 10000 10000 seems correct, except it misses the very first digit. Re: WA 22 Combatcook [YarSU] 🐸 4 Dec 2016 20:24 Thanks! Stupid mistake, as always, just increased size of long number. |
| WA Test #3 | TwoFace | 1787. Turn for MEGA | 4 Dec 2016 16:17 | 2 |
import java.util.*; import java.io.*; public class MEGA { public static void main(String arg[]) { int k,n,i,sum=0; Scanner scan=new Scanner(System.in); k=scan.nextInt(); n=scan.nextInt(); int[] a=new int[n]; for(i=0;i<n;) { if(scan.hasNextInt()) { a[i]=scan.nextInt(); i++; } } for(i=0;i<n;i++) { sum+=a[i]-k; } if(sum<0) { System.out.println("1"); } else { System.out.println(""+sum); } } } This very simple program is turning out to be a headache. What is Test #3? inside cycle you need to check that (sum + a[i] - k) >=0 Edited by author 04.12.2016 16:18 Edited by author 04.12.2016 16:18 |
| Getting WA#2 | Anand Zutshi | 1042. Central Heating | 4 Dec 2016 10:10 | 1 |
ll n; ll ar[300][300]; int main(){ cin >> n; for(ll i = 1; i <= n; i ++) for(ll j = 1; j <= n; j ++) ar[i][j] = 0; for(ll i = 1; i <= n; i ++){ while(1){ ll x; cin >> x; if(x == -1) break; ar[x][i] = 1; } } for(ll i = 1; i <= n; i ++) ar[i][n+1] = 1; ll col = 1; while(col <= n){ if(ar[col][col] == 1){ for(ll i = 1; i <= n; i ++){ if(i == col) continue; if(ar[i][col] == 1){ //choose ith row for(ll j = 1; j <= n+1; j ++) ar[i][j] = ar[i][j]^ar[col][j]; } } } else{ break; } col ++; } bool f = 1; ll br[300][300]; for(ll i = 1; i <= n; i ++) for(ll j = 1; j <= n; j ++) if(i==j) br[i][j] = 1; for(ll i = 1; i <= n; i ++){ for(ll j = 1; j <= n; j ++) if(ar[i][j]!=br[i][j]) f = 0; } if(!f) cout << "No solution" << endl; else{ for(ll i = 1; i <= n; i ++){ if(ar[i][n+1]==1) cout << i << " "; } } return 0; } I have used basic Gauss algorithm making the augmented matrix equal to an identity matrix. Still getting WA. Please help Thank you :) Edited by author 04.12.2016 10:11 |
| Something is grammaticaly incorrect in the problem description... | Georginsky | 1185. Wall | 4 Dec 2016 05:14 | 2 |
"If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will LOOSE his head." http://grammarist.com/usage/loose-lose/ |
| Incomplete Test Set | espr1t | 2103. Corporate Mail | 3 Dec 2016 18:42 | 1 |
I got AC with a wrong solution during the contest, so I think the test cases might be a bit weak. One example my wrong solution didn't pass is: 7 63713822 It printed 3, while the best answer is 2: 7 -> 8 -> 31856912 -> 31856911 -> 63713822. Can you please add it to the test-set? (Edit: I've fixed my solution now, but others may fail.) Edited by author 03.12.2016 18:42 |
| what is the 4 test ? | Bekzat | 1585. Penguins | 3 Dec 2016 08:28 | 1 |
my code #include <bits/stdc++.h> using namespace std; int main() { int n, c = 0, s = 0, v = 0, maxn = 0; cin >> n; string a, b; for(int i = 1; i <= n; i++){ cin >> a ; for(int i = 0; i <= a.size(); i++){ if(a[0] == 'E' && a[1] == 'm' && a[2] == 'p' && a[3] == 'e' ){ c++; break; } else if( a[0] == 'M' && a[1] == 'a' && a[2] == 'c' && a[3] == 'a'){ s++; break; } else if(a[0] == 'L' && a[1] == 'i ' && a[2] == 't' && a[3] == 't' ){ v++; break; } } cin >> b; } if(c > s && c > v){ cout << "Emperor Penguin"; } else if(s > c && s > v){ cout << "Macaroni Penguin"; } else if(v > c && v > s){ cout << "Little Penguin"; } return 0; } why incorrect |
| WA7 and WA10 | 💻Evgeny Nemtsev [UrFU FT-17] | 1343. Fairy Tale | 3 Dec 2016 03:02 | 1 |
WA7 3 000 -> 000000000002 WA10 0 -> 000000000002 |
| No subject | Yekaterina | 1293. Eniya | 2 Dec 2016 20:52 | 1 |
Program zadacha; Var a,b,c,n:integer; Begin Readln(n,a,b); c:=a*b*2*n; Write(c); End. |
| что не так? Help please!!! What's wrong? C++ | AndrewSultan | 1001. Reverse Root | 2 Dec 2016 13:48 | 3 |
#include<stdio.h> #include<math.h> main() { float a,b,c,d; scanf("%f%f%f%f", &a,&b,&c,&d); printf("%6.4f\n%6.4f\n%6.4f\n%6.4f",sqrt(d), sqrt(c), sqrt(b), sqrt(a)); } Whats wrong? Edited by author 27.06.2016 15:47 Edited by author 27.06.2016 15:47 С чего ты взял что у тебя всего 4 числа? who tell u only 4 inputs? |