Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA6 | ura | 1140. Swamp Incident | 10 Dec 2018 20:32 | 1 | WA6 ura 10 Dec 2018 20:32 | | задача оч короткая | dasw35 | 1264. Workdays | 10 Dec 2018 19:57 | 1 | Edited by author 21.01.2019 19:40 | | To admins: Input format question: | lenny | 1039. Anniversary Party | 10 Dec 2018 17:42 | 2 | If it is a real tree, why after N lines, describing conviviality ratings of employees, we have not simply (N - 1) lines, describing supervisor relations? Does such input format mean that some employees may have more than one supervisors? Edited by author 21.06.2012 18:08 Input contains only one tree (not forest) so don't worry about this ! | | How can I not Memory Limit Exceeded? | clavichord | 1039. Anniversary Party | 10 Dec 2018 17:39 | 3 | Why do I memory limit exceeded even if I have use pointer? Here is my code: const mn=6000; inf=-100000000; type rec=record father:integer; num:integer; child:array[1..mn]of ^integer; end; var value:array[1..mn]of ^integer; f:array[1..mn,1..2]of ^longint; t:array[1..mn]of ^rec; n,i,a,b,root:integer; ans:longint; function max(a,b:longint):longint; begin if a>b then exit(a) else exit(b); end; function dp(root,lab:integer):longint; var i:integer; begin if root=0 then exit(0); if f[root,lab]^>inf then exit(f[root,lab]^); if lab=1 then begin f[root,lab]^:=value[root]^; for i:=1 to t[root]^.num do inc(f[root,1]^,dp(t[root]^.child[i]^,2)); end else begin f[root,lab]^:=0; for i:=1 to t[root]^.num do inc(f[root,2]^,max(dp(t[root]^.child[i]^,1),dp(t[root]^.child[i]^,2))); end; exit(f[root,lab]^); end; begin readln(n); for i:=1 to n do begin new(value[i]); new(t[i]); new(f[i,1]); new(f[i,2]); readln(value[i]^); end; while not eof do begin readln(a,b); if(a=0)and(b=0)then break; t[a]^.father:=b; inc(t[b]^.num); new(t[b]^.child[t[b]^.num]); t[b]^.child[t[b]^.num]^:=a; end; for i:=1 to n do if t[i]^.father=0 then begin root:=i; break; end; for i:=1 to n do begin f[i,1]^:=inf; f[i,2]^:=inf; end; ans:=max(dp(root,1),dp(root,2)); writeln(ans); end. Who can HELP me? Edited by author 05.04.2010 16:57 because u r using much memory.. run it on ideone.. u will come to know This problem is too simple than you think :) Edited by author 10.12.2018 17:39 | | Some test cases | Smilodon_am [Obninsk INPE] | 2108. Oleg and Little Ponies | 10 Dec 2018 01:38 | 1 | Some test cases that helped me: 6 4 001000 100001 000100 000010 010000 100100 100000 111000 100000 ans: 111111 6 4 010000 100000 001000 100001 100000 111000 000100 000001 100000 ans: 111001 6 4 100000 111000 010000 100000 001000 100001 000100 000001 000000 ans: 000000 6 4 111100 111000 111110 100000 000000 100001 111111 000001 010100 ans: 110101 6 4 111000 101000 111100 111000 111110 100000 111111 000001 011100 ans: 011100 6 0 010100 ans: 010100 | | I think problem is wrong | JamesBond_007 | 1112. Cover | 9 Dec 2018 19:55 | 1 | 6 1 5 2 6 3 7 4 8 5 9 6 10 WHY answer is: 2 1 5 5 9 I think [2;6] and [3;7] have common interior point such as 3, 4, 5, 6. | | What's the meaning of "Land fragments that are adjacent to the map's border are not considered as islands." ??? | XueMao | 1250. Sea Burial | 9 Dec 2018 18:40 | 3 | What's the meaning of "Land fragments that are adjacent to the map's border are not considered as islands." ??? I can hardly understand it ! in the Example input, There is two island adjacent to the map's border(the north-east corner and the south-west corner) . but the answer is 3 !!! can anyone help me ? See here (+) Dmitry 'Diman_YES' Kovalioff. Retired 20 Mar 2003 17:35 In the first sample I checked the sacred islands' territory as '*': ........# .*******. .*.....*. .*.*.*.*. .*.....*. .*******. #........ So, there are 3 sacred islands. The land fragments in the corners of the map are not the islands, because they are adjacent to the map's border. but those islands are not in the same sea | | tests | 🦄imosk72🦄[GTGU] | 1947. Meander | 8 Dec 2018 21:47 | 1 | tests 🦄imosk72🦄[GTGU] 8 Dec 2018 21:47 /\/\/ \/\/\ /\*\/ \/\/\ /\/\/ ans: FAIL \/\/\ \/\/* //\// \\\// \/\\/ ans: U2 /\/// \/\\/ /\\*\ \/\// /\/\\ ans: WIN \\/// //\// *\\\\ \\\/\ //\// ans: U1 \/\// \/\\\ ///// *\\\\ \//\/ ans: WIN | | prolem description didn't say one bank can only buy one detor | Shen Yang | 1652. Banking Crisis | 8 Dec 2018 13:45 | 1 | so this is a NP complete problem ,how can it be solved with 1000 range.. I don't know | | WA on test 5 | Abhishek | 1471. Distance in the Tree | 8 Dec 2018 12:26 | 2 | Can anybody tell me test 5,i am getting WA.I have tried my code on many random cases and it works fine. Code:- #include<bits/stdc++.h> #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define SET(a,b) memset(a,b,sizeof(a)) #define LET(x,a) __typeof(a) x(a) #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) #define loop(i,a,b) for(int i=a;i<b;i++) #define si(n) scanf("%d",&n) #define sll(n) scanf("%lld",&n) #define sortv(a) sort(a.begin(),a.end()) #define all(a) a.begin(),a.end() #define bitcount(n) __builtin_popcount(n) #define DRT() int t; cin>>t; while(t--) #define TRACE #ifdef TRACE #define trace1(x) cerr << #x << ": " << x << endl; #define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl; #define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl; #define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl; #define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl; #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl; #else #define trace1(x) #define trace2(x, y) #define trace3(x, y, z) #define trace4(a, b, c, d) #define trace5(a, b, c, d, e) #define trace6(a, b, c, d, e, f) #endif using namespace std; typedef long long int lli; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector< vi > vvi; typedef vector< ii > vii; lli modpow(lli a,lli n,lli temp){lli res=1,y=a;while(n>0){if(n&1)res=(res*y)%temp;y=(y*y)%temp;n/=2;}return res%temp;} //***********************************END OF TEMPLATE********************************************************************* const int MAX = 50005,MAX2=log2(MAX); int d[MAX],h[MAX],P[MAX][MAX2],n; vector<vii> graph(MAX); void dfs(int u,int p){ P[u][0]=p; h[u]=h[p]+1; for(auto k:graph[u]){ if(k.F==p)d[u]=d[p]+k.S; else dfs(k.F,u); } } void init(){ for(int i=0;i<n;++i){ for(int j=0;(1<<j)<n;++j)P[i][j]=-1; } d[0]=0; h[0]=-1; dfs(0,0); for(int j=1;(1<<j)<n;++j){ for(int i=0;i<n;++i){ if(P[i][j-1]!=-1)P[i][j]=P[P[i][j-1]][j-1]; } } } int lca(int u,int v){ if(h[u]>h[v])swap(u,v); int l=log2(h[v]); for(int i=l;i>=0;--i){ if(h[v]-(1<<i)>=h[u]&&P[v][i]!=-1)v=P[v][i]; } //u and v at same level if(u==v)return u; for(int i=l;i>=0;--i){ if(P[u][i]!=P[v][i]&&P[u][i]!=-1){ u=P[u][i]; v=P[v][i]; } } return P[u][0]; } int query(int u,int v){ int lc = lca(u,v); return d[u]+d[v]-2*d[lc]; } int main(){ int u,v,w,q; si(n); loop(i,1,n){ si(u);si(v);si(w); graph[u].PB(MP(v,w)); graph[v].PB(MP(u,w)); } init(); si(q); while(q--){ si(u);si(v); printf("%d\n",query(u,v)); } return 0; } Edited by author 17.01.2016 01:13 | | WA#4 | vessel | 1471. Distance in the Tree | 8 Dec 2018 11:57 | 2 | WA#4 vessel 6 Dec 2006 18:05 wa#4 for countless times, seek for kind help! thanks Re: WA#4 MOPDOBOPOT (USU) 8 Dec 2018 11:57 | | Что не правильно? паскаль | Lena | 1283. Dwarf | 7 Dec 2018 22:02 | 2 | var a,b,c,i,k:real; begin read(a,b,c); while a>b do begin a:=a-(a*c/100); I:=i+1; end; write(i); end. variable i should be integer ! | | What's wrong? | Markfryazino | 1283. Dwarf | 7 Dec 2018 21:58 | 2 | Here is the code (python 3.6). Can anyone explain, why it fails on test 9? import math string = input().split() start = int(string[0]) end = int(string[1]) commission = int(string[2]) if start <= end: n = 0 else: q = 1 - commission / 100 n = math.log((end / start), q) n = round(n) print(n) Use float / double instead of int ! | | WA47 | German | 2102. Michael and Cryptography | 7 Dec 2018 17:07 | 6 | WA47 German 27 Feb 2017 14:20 1) Find the prime numbers up to 10,000,100 (Sieve of Eratosthenes) 2) if the sum is equal to 19 degrees, then the residue is prime to check What can you advise? 1) Up to 10M? 2M is enough. sqrt( 10^18 / 2^18) ~= 1.5M 2) "Yes" precondition: N > 1 "Yes" condition: sum is 20 and residue is 1 "Yes" condition: sum is 19 and residue>1 and residue is prime Could you show please code? AC Edited by author 09.03.2017 18:16 > if (kol == 20){ It's suspicious a bit. Please try test (2^20)*3, expected answer is No 3145728 No 20^20 * 3^1 sum 21 if I understand condition of the problem: 3^1*5^1*7^2*11^1*17^12*23^3 answer is "Yes" ? Edited by author 01.03.2017 13:26 | | Java runtime error - SOLVED | IFrank | 2001. Mathematicians and Berries | 7 Dec 2018 13:58 | 3 | In Idea my code works, but here is a runtime error: import java.util.Scanner; public class MathematiciansAndBerries { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); byte a1 = scanner.nextByte(); byte b1 = scanner.nextByte(); byte a2 = scanner.nextByte(); byte b2 = scanner.nextByte(); byte a3 = scanner.nextByte(); byte b3 = scanner.nextByte(); System.out.println((a1 - a3) + " " + (b1 - b2)); } } Help pls, why runtime error occurs? Edited by author 06.12.2018 21:47 Changed byte to int and now it works ok here. Idiotic. I don't think a mathematician can bring more than 127 kg)) "0 <= ai, bi <= 10,000" Sure, do not read condition is idiotic. | | That problem is EVIL | Nikita Mogilevets | 1226. esreveR redrO | 7 Dec 2018 00:34 | 3 | I think I can not get AC because of "Enter" key on Windows is "\r\n" and C++ scanf() reads it as "\n" and printf() writes "\n" as "\r\n". So, if in input is some "\n", then I would read it as "\n" and then print it as "\r\n"!!! I don't know how to fix that. Also there were problems with EOF-character. Yeah, I have the same problem! My ass is burning after solving this problem | | Test #11 | DKarev | 1226. esreveR redrO | 6 Dec 2018 23:55 | 2 | The test is empty. There is nothing there. | | Wrong Answer (Python 3.3) | Nerlin | 1226. esreveR redrO | 6 Dec 2018 23:41 | 2 | I really don't understand why my solution is wrong but here it is: letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" start = 0 s = input() for i in range(0, len(s)): if not(s[i] in letters): word = s[start:i] other = s[i:i+1] if (word != ""): print(word[::-1], end="")
print(other, end="") start = i+1 if (start != len(s)): print(s[start:len(s)][::-1], end="") What's wrong with this solution? WA (Test 2) Edited by author 30.03.2013 23:10 I think that the input can be more than one line. | | test n=48 | ura | 1217. Unlucky Tickets | 5 Dec 2018 23:59 | 1 | верно ли,что при n=48,ответ 793566522023068987143383410279408208612410000 а при n=100 3834688188199309756675466732967588185862422492337212276545580039517258085033387305291001857619600 | | To admins: incorrect 'Compilation Error' verdict with Visual C++ 2017 compiler | Smilodon_am [Obninsk INPE] | 1314. Chase in Subway | 4 Dec 2018 01:57 | 1 | Hello. I have received strange 'Compilation Error' verdict for my solution on the 1314 task under Microsoft Visual C++ 2017 compiler. Compilation log is as follows: ///////////////////////////////////////// lg1vr1-w2nnli(24): error C2062: type 'float' unexpected lg1vr1-w2nnli(84): warning C4244: 'argument': conversion from 'float' to 'const int', possible loss of data lg1vr1-w2nnli(94): warning C4018: '<': signed/unsigned mismatch ///////////////////////////////////////// Lines 23 and 24 of my code are: ///////////////////////////////////////// const int MAX_STATION_ID = 32767L; const int INFINITY = 10L * MAX_STATION_ID; ///////////////////////////////////////// Commits with CE are 8162255, 8162250, 8162248. But there is successful (Accepted) commit 8162257 (the same code as 8162255) under G++7.1 commit. Could you check if the CE message was correct or not? Best regards. Edited by author 04.12.2018 02:01 |
|
|