Common Board| Show all threads Hide all threads Show all messages Hide all messages | | AC, no problem ;-) | Ilya Mitin (2) | 1111. Squares | 18 Aug 2019 11:48 | 3 | my code passed yours test but shows WA1 #include <bits/stdc++.h> using namespace std; int main() { int N,a[55],b[55],i,c[55],j,d[55],t,e[55],m,n; unsigned long long x,y,p,arr[55]; cin>>N; for(i=0;i<N;i++){ cin>>a[i]>>b[i]>>c[i]>>d[i]; e[i]=i; } cin>>m>>n; for(i=0;i<N;i++){ x=max(a[i]-m,m-c[i]); if(x<0){ x=0; } y=max(b[i]-n,n-d[i]); if(y<0){ y=0; } arr[i]=x*x+y*y; } for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(arr[i]>a[j]){ p=arr[i]; arr[i]=arr[j]; arr[j]=p; t=e[i]; e[i]=e[j]; e[j]=t; } } } for(i=0;i<N;i++){ cout<<e[i]+1<<" "; } return 0; } | | WA on #test 1 | abid1729 | 1111. Squares | 18 Aug 2019 01:04 | 1 | /****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int main() { int N,a[55],b[55],i,c[55],j,d[55],e[55],m,n; unsigned long long x,y,arr[55]; cin>>N; for(i=0;i<N;i++){ cin>>a[i]>>b[i]>>c[i]>>d[i]; e[i]=i; } cin>>m>>n; for(i=0;i<N;i++){ x=max(a[i]-m,m-c[i]); if(x<0){ x=0; } y=max(b[i]-n,n-d[i]); if(y<0){ y=0; } arr[i]=x*x+y*y; } for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(arr[i]>a[j]){ arr[i]=arr[j]; e[i]=e[j]; } } } for(i=0;i<N;i++){ cout<<e[i]+1<<endl; } return 0; } | | AC Visual C | Ntstharen | 2025. Line Fighting | 17 Aug 2019 21:01 | 1 | #include<stdio.h> int main(){ int N, n, k, i, a, b, x, res; scanf("%d\n", &N); for(i=0; i<N; i++){ scanf("%d %d", &n, &k); if(n%k==0){ x=n/k; res=n*(n-x)/2; printf("%d\n", res); } else { x=n/k; b=n-k*x; a=k-b; res=((n-x)*a*x+(n-x-1)*(x+1)*b)/2; printf("%d\n", res); } } return 0; } | | Why this solution get WA1? | Buzmakov Dmitriy | 2031. Overturned Numbers | 17 Aug 2019 00:31 | 2 | #include <bits/stdc++.h> string c[4] = {"88", "68", "06", "16"}; int main() { cin >> n; if (n > 4) { cout << "Glupenky Pierre" << endl; return 0; } for (int i = n - 1; i >= 0; i--) cout << c[i] << " "; } "68 88" is good, isn't? There are many more combinations. You also forgot 9 | | Python 3, wrong on test 2 | Krasheninnikova | 1263. Elections | 16 Aug 2019 21:55 | 2 | n, m = map(int,input().split(' ')) voices = [] p = ['p'] h = 0 for i in range(m): voices.append(int(input()))
for i in range(n): p.append(0) for i in voices: for c in range(n+1): if i == c: p[c] += 1
for i in range(1, len(p)): h = p[i] / m * 100 p[i] = str(round(h, 2)) if len(p[i]) == 4: p[i] += '0' print(p[i] + '%') Help. what's wrong n, m = map(int,input().split(' ')) voices = [] p = ['p'] h = 0 for i in range(m): voices.append(int(input())) for i in range(n): p.append(0) for i in voices: for c in range(n+1): if i == c: p[c] += 1 for i in range(1, len(p)): h = p[i] / m * 100 print(f'{h:.2f}%') This is your code that prints the right answer. Python 3 uses BANKER'S rounding while the problem asks you to the MATHEMATICAL rounding. I used 'f-string' to perform MATHEMATICAL rounding. Anyways, the solution is not fast enough - try to come up with some speed-ups. | | To administrator | Loky | 1075. Thread in a Space | 16 Aug 2019 13:54 | 3 | You should add some test. So my AC programm give wrong answer on this test 20 0 0 -20 0 0 0 0 0 10 --- Write answer is 51.42; and my answer is 45.11 Please do something!!! Sorry! I understood my mistake. 45.11 is the correct answer | | what is there in test 6 ?? Can anyone please provide some test cases | anupam ghosh | 1123. Salary | 16 Aug 2019 09:01 | 1 | what is there in test 6 ?? Can anyone please provide some test cases. I have tried all test cases provided in earlier discussions, all of these pass. Still getting WA6. Want to jump off some cliff now, if that might solve this WA6. | | This is pretty simple task | Skeef79 | 2112. Battle log | 15 Aug 2019 23:45 | 1 | just use DSU to check teams, and then build answer | | Why WA 2? | AndrewSt(ArcSTU) | 1123. Salary | 15 Aug 2019 20:13 | 19 | My programm write this Answers: Test 1 1999 2002 Test 2 1250025 1251521 Test 3 100003 101101 Test 4 1000003 1001001 Test 4 11111 11111 Give me please some tests? Edited by author 04.12.2006 03:35 Ans for your test 1 is 2002 :) I'm Sorry is my bags. My programm write 2002 All other tests right I'll give you some test.. just 10 min I think that it will help you:) 18 22 36313404080 36313531363 3373687313428241827948801150507677526 3373687313428241828281428243137863733 669262074855963079771197586206281259112 669262074855963079787970369558470262966 242167700017836474388100 242167700018810007761242 16252383 16266261 469342775745586144105609869 469342775745595547577243964 37461293193018561603953493340 37461293193018681039139216473 9194184285169534216966507128749 9194184285169535359615824814919 21 22 1330454685235862 1330454774540331 78336742687917227491028 78336742688088624763387 47923802054017335212073765802860114 47923802054017335353371045020832974 505752 506605 940 949 428540910018912794058956977 428540910018929810019045824 9770330728908946347636591906356869449214 9770330728908946347777436498098270330779 7068416097840258049887921681085 7068416097840259520487906148607 517805724457730620 517805725527508715 506833497 506848605 5820 5885 484243646784563247619038458645194136 484243646784563248842365487646342484 91413688117232096060 91413688122188631419 771886477139587251334596 771886477140041774688177 8304292305552149553379655920949280409378 8304292305552149553443559412555032924038 9628134090110628 9628134114318269 2445193927845273449357413443 2445193927845335487293915442 519 525 6885428526826048829 6885428527258245886 72924386042452563577194755578 72924386042452625424068342927 36313404080 Why Answer 36313531363? True Answer 36313431363. I think new tests should be added :)))) My AC prog also returns 123012 124421 36408 36563 .... WHY???? IF TRUE 123012 123321 36408 36463 I testing tests.My programm write : 1999 2002 1250025 1250521 100003 101101 1000003 1001001 11111 11111 18 22 36313404080 36313431363 3373687313428241827948801150507677526 3373687313428241828281428243137863733 669262074855963079771197586206281259112 669262074855963079777970369558470262966 242167700017836474388100 242167700018810007761242 16252383 16255261 469342775745586144105609869 469342775745595547577243964 37461293193018561603953493340 37461293193018581039139216473 9194184285169534216966507128749 9194184285169534359615824814919 21 22 1330454685235862 1330454774540331 78336742687917227491028 78336742687978624763387 47923802054017335212073765802860114 47923802054017335253371045020832974 505752 506605 940 949 428540910018912794058956977 428540910018919810019045824 9770330728908946347636591906356869449214 9770330728908946347667436498098270330779 7068416097840258049887921681085 7068416097840258520487906148607 517805724457730620 517805725527508715 506833497 506838605 5820 5885 484243646784563247619038458645194136 484243646784563247742365487646342484 91413688117232096060 91413688122188631419 771886477139587251334596 771886477139931774688177 8304292305552149553379655920949280409378 8304292305552149553443559412555032924038 9628134090110628 9628134114318269 2445193927845273449357413443 2445193927845335487293915442 519 525 6885428526826048829 6885428527258245886 72924386042452563577194755578 72924386042452625424068342927 Some of your answers <KIRILL(ArcSTU)> are wrong!!! 16252383, 9770330728908946347636591906356869449214 and some other It is amazingly if you got AC WA 2 Ilya Mitin (2) 22 Jun 2008 18:15 If you get WA2 test: 123 right aswer 131 but not 222 Thanks, Ilya Mitin, you helped me))) KIRILL(ArcSTU) : did you get an AC? because of below result is correct 16252383 16255261 TEST2 why not be 1250521? I think testing program is incorrect if AC programs give wrong answers :( My program gives correct answers to all test and still WA6 :(( Re: Why WA 2? Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM 13 Feb 2009 10:28 your test 2 is wrong ! true answer : 1250521 In test 1250025 answer must be 1250521. | | DELETED | Gilles Deleuze | 2076. Vasiana | 14 Aug 2019 23:52 | 1 | DELETED Gilles Deleuze 14 Aug 2019 23:52 DELETED Edited by author 15.08.2019 10:11 | | weak tests | 🦄Imosk72🦄∭GTGU∭ | 1157. Young Tiler | 13 Aug 2019 14:05 | 2 | in my accepted program I checked if i <= 10000 but printed i + k, so for test like 6 0 2 it printed 10001 but I think correct answer should be 0 your test is incorrect, cause n,m,k bigger , then 0 | | why Compilation error | Nima Naderi | 1149. Sinus Dances | 12 Aug 2019 13:13 | 2 | my code: #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<string , string> pss; #define all(x) (x).begin(),(x).end() #define Sort(x) sort(all((x))) #define F first #define S second #define sep ' ' #define file_io freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout); #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define error(x) cerr << "$$$ " << x << '\n'; #define error2(x,y) cerr << "#F : " << x << " #S : " << y << '\n'; #define pb push_back const ll MX5 = 3*1e5+3; const ll MX6 = 2*1e6+3; const ll INF = 8e18; const ll MOD = 1e9 + 7; const ll MOD2= 998244353; ll power(ll a, ll b, ll md) { return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md)); } ll bmm(ll a,ll b){ return (a%b==0 ? b : bmm(b,a%b)); } ll A[MX5]; string num(ll n){ string ans=""; while(n){ ans=(char)(n%10+'0')+ans; n/=10; } return ans; } string An(ll t,ll n){ string a=num(t); if(t==n){ return "sin("+a+")"; } if(t%2==1){ return "sin("+a+"-"+An(t+1,n)+")"; } return "sin("+a+"+"+An(t+1,n)+")"; } string Sn(ll t,ll n){ string a=num(n-t+1); if(t==1){ return An(1,1)+"+"+a; } return "("+Sn(t-1,n)+")"+An(1,t)+"+"+a; } int main(){ fast_io //file_io ll n; cin >> n; string answer=Sn(n,n); cout << answer; return 0; } Edited by author 12.08.2019 13:01 i find out its because of language of compiler use G++ 7.1 for c++ :) | | AC C++ | soroush | 1654. Cipher Message | 12 Aug 2019 12:27 | 1 | AC C++ soroush 12 Aug 2019 12:27 #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX = 1e5+10; const ll ZERO = 0; #define endl '\n' #define dokme(x) cout << x ; return(0); #define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); stack < char > stk; int main(){ migmig; stk.push('.'); char c[200001]; cin >> c; int n=strlen(c); for (int i =0; i < n ; i ++ ){ if (stk.top()!=c[i]){ stk.push(c[i]); } else{ stk.pop(); } } n=stk.size()-1; memset(c,0,sizeof(c)); for (int i = 0 ; i<n ; i ++ ){ c[n-i-1]=stk.top(); stk.pop(); } cout << c; } | | How???? | vtalgo19_NChernyshev☭ | 1000. A+B Problem | 12 Aug 2019 10:28 | 2 | How???? vtalgo19_NChernyshev☭ 8 Jun 2019 03:15 Im struggling with it for few days, but absolutely have no idea how to do it! Any hints?? What specifically are you having a problem with? For example, are you trying to figure out how to write your code so that it reads and saves the input? | | Why Runtime error | Vlad | 1001. Reverse Root | 12 Aug 2019 10:16 | 2 | import java.util.Scanner; public class Main { private static void checking(double a){ if(Math.sqrt(a)%1==0){ System.out.printf("%.0f",Math.sqrt(a)); }else{ System.out.printf("%.4f",Math.sqrt(a)); } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Сколько чисел хотите ввести: "); int a = scanner.nextInt(); double[] b = new double[a]; for (int i = 0; i < b.length; i++) { System.out.print("Число " + (i+1) + ": "); b[i] = scanner.nextDouble(); } for(double c : b){ System.out.print("Корень " + c + " = "); checking(c); System.out.println(); } } } I'm not sure what's causing the runtime error, but I tried your code on an online compiler and this was the error message I got: Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextDouble(Scanner.java:2564) at Main.main(Main.java:22) | | [PYTHON] Can anyone please tell me why this gives wrong answer on test 1? It works fine with my compiler fo a lot of cases. | rayneh | 1001. Reverse Root | 12 Aug 2019 10:01 | 2 | import math import re input_string = '' while True: line = input() if line: input_string = input_string + ' ' + line else: break input_digits = [int(x) for x in input_string.replace('\n',' ').replace('\t', ' ').split()] input_digits = input_digits[::-1] for int in input_digits: sqr_root = math.sqrt(int) print(format(sqr_root, '.4f')) #Thanks for the help guys! I tested your code on some online compilers, and the last two answers were printed, but not the first two. It looks like your algorithm correctly read the first line, but because there were empty lines for the next couple lines, your break statement kept the code from reading the last two lines in the example testcase. You need to change the code so it can read all the lines, even the ones that come after empty lines. | | Hint (possible test) for WA50 | maslowmw | 2102. Michael and Cryptography | 11 Aug 2019 22:44 | 1 | 2^19 or another where factorized number = 19 | | Good test | Skeef79 | 1208. Legendary Teams Contest | 10 Aug 2019 22:27 | 1 | IF you have TL, try this test: 18 aasda0sd basdasdasd casdasd asdasd33a 0b12asdasd ca45sdasd cdasdas3das dasd0asda2ds e1dasqew sdsdad4asdsaf dasda0sdasd 0gasdasd asdasda5sa asdasdasd3b asda0sdasdc aqwewq6e bqweqwe cqweq0we cqweqw7e dqweqwe eqw3ewqees fsadasd8asd dasdasdas0d gasdasd asdasds9adasa abasdas3dads casdasd12 qweqwew123qea bqweqw3ewqe cweqqwee csadas12d dasdas0d ed0dsdadsa fdasdasd33 dasdasds30ad gasasdsad adasdasd123d badas3ddasda cdasds0adas asdads455as basdasda2sd casdasdd0sa cqwewq123e deeqw12e eqw1easda8d fasd123asd dasdasds3a1dqw gqwe9wqewes jeqweqw123e eqweq123wewee hwewe9wqq ldszczx123c ad123sdasdaq qweweq09f ans: 18 Edited by author 10.08.2019 22:28 Edited by author 10.08.2019 22:28 Edited by author 10.08.2019 22:28 | | AC in 0.001 | abid1729 | 1348. Goat in the Garden 2 | 9 Aug 2019 23:41 | 1 | #include<bits/stdc++.h> using namespace std; int main() { double a,b,c,d,m,n,l,p,t,s,k; cin>>a>>b>>c>>d>>m>>n>>l; p=sqrt((a-m)*(a-m)+(b-n)*(b-n)); t=sqrt((c-m)*(c-m)+(d-n)*(d-n)); s=max(p,t); if(s>l){s-=l; } else{ s=0;} k=min(p,t); if(k<=l){ k=0; } else if(p==t){ a=(a+c)/2,b=(b+d)/2; k=sqrt((a-m)*(a-m)+(b-n)*(b-n)); if(k<=l){ k=0; } else{ k-=l; } } else{ while(abs(p-t)>.001){ if(p<t){ c=(a+c)/2,d=(b+d)/2; t=sqrt((c-m)*(c-m)+(d-n)*(d-n)); } else{ a=(a+c)/2,b=(b+d)/2; p=sqrt((a-m)*(a-m)+(b-n)*(b-n)); } } k=min(p,t); if(k<=l){ k=0; } else{ k-=l; } } cout<<fixed<<setprecision(2)<<k<<endl; cout<<fixed<<setprecision(2)<<s<<endl; } | | Invalid test | aid | 1473. Farm 2 | 8 Aug 2019 23:41 | 2 | There seems to be some junk at the end of test 27. My solution with "while (read()) solve();" got WA but when I removed it I got OK. Test was fixed. Thank you! |
|
|