MohamedAhmed04's blog

By MohamedAhmed04, history, 7 months ago, In English,

hello, there's something weird happened to me in szkopul website which caused TLE and after small changes to the code, it got AC..it happened to me in 2 problems.

1 — first problem : POI10-sums

I got 90 with this code and got TLE in test case 8 , but after that I got the full score using this code , the only difference between the two codes is that loop in dijkstra which in first code is :

for(int i = 0 ; i < n ; ++i)
{
    int now2 = now + arr[i] ;
    int cur2 = (cur + arr[i]) % arr[0] ;
    if(now2 > 1e9)
        continue ;
    if(now2 < vis[cur2] && now2 <= 1e9)
    {
        vis[cur2] = now2 ;
        q.push({now2 , cur2}) ;
    }
}

but in second code it's :

for(int i = 0 ; i < n ; ++i)
{
    int now2 = now + arr[i] ;
    int cur2 = (cur + arr[i]) % arr[0] ;
    //if(now2 > 1e9)
    //    continue ;
    if(now2 < vis[cur2] && now2 <= 1e9)
    {
        vis[cur2] = now2 ;
        q.push({now2 , cur2}) ;
    }
}

so the only difference is that I put this comment , there's no additional loop or nothing and the condition also was right.

2 — second problem : POI15-seals

I got 56 with this code and got TLE at test case 6, 7, 8, and 9, after that I made a small change and got 100 with this code, the only difference is that I made

char arr[n][m] , arr2[a][b] ;

in the first code , and replaced it with

vector<string>arr(n) ;
vector<string>arr2(a);

in the second code, and I don't think that makes that great difference because it's the same time in taking input.

so I would like to know what makes first codes in this two problems get TLE and after very small differences it got the full score even that these small differences don't affect the time of the codes.

hope the blog wasn't long and hope to know the reason of TLE.

Thanks.

Read more »

 
 
 
 
  • Vote: I like it
  • +12
  • Vote: I do not like it

By MohamedAhmed04, history, 9 months ago, In English,

after rating updated in Codeforces....now ratings returned as it was before the last contest...even in contest standing there's no rating changes....so what's the reason for that

UPD : ratings came back

Read more »

 
 
 
 
  • Vote: I like it
  • +45
  • Vote: I do not like it

By MohamedAhmed04, history, 13 months ago, In English,

When I opened problem set and sorted it , It showed me palindromic twist is the first!!

Update : It's solved now

Read more »

 
 
 
 
  • Vote: I like it
  • +22
  • Vote: I do not like it

By MohamedAhmed04, history, 13 months ago, In English,
 
 
 
 
  • Vote: I like it
  • +29
  • Vote: I do not like it

By MohamedAhmed04, history, 16 months ago, In English,

Why Wrong Answer in this Problem

I Solved it using Segment tree and lazy propagation

Problem Link : http://www.spoj.com/problems/CDC12_H/

My Solution Link : https://ideone.com/Td4sDM

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By MohamedAhmed04, history, 16 months ago, In English,

Hello CF Community

From 20 minutes Facebook announced Facebook Hacker Cup 2018.

Link of Post : https://www.facebook.com/hackercup/posts/1915605128471666

They Said That To Compete You must be higher than 18 years

So Is there way to participate in Facebook Hacker Cup For People < 18 ?

At Most For Competing Not For Winning Prizes

Read more »

 
 
 
 
  • Vote: I like it
  • -16
  • Vote: I do not like it

By MohamedAhmed04, history, 17 months ago, In English,

I Found This Library on GitHub which is For preparing Tests For Problems and It's written in C++ , I Think It will help Problem Setters For Rounds

https://github.com/ifsmirnov/jngen

Read more »

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

By MohamedAhmed04, history, 21 month(s) ago, In English,

Anyone have good resources for tabulation in DP

Read more »

 
 
 
 
  • Vote: I like it
  • -32
  • Vote: I do not like it

By MohamedAhmed04, history, 21 month(s) ago, In English,

Hello ,

I saw most of programmers in Codeforces use Tabulation more than Memoization So , Why most of competitive programmers use Tabulation instead of memoization ?

Read more »

 
 
 
 
  • Vote: I like it
  • +6
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

It's the first problem for me to solve with DFS , So I can't understand why it's wrong Answer on test 6 The link of code and submission : http://codeforces.com/contest/580/submission/30840380 Problem link : http://codeforces.com/problemset/problem/580/C

Read more »

 
 
 
 
  • Vote: I like it
  • -3
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

Is there's anyone has good tutorial or Video that describe Bitmask with cases ? In C++

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

There's Wrong Answer on test case 14 I tried to solve it But What's in Code wrong that lead to print 146 instead of 120 Code : https://ideone.com/gwUN8C Problem : http://codeforces.com/contest/186/problem/B Submission : http://codeforces.com/contest/186/submission/30480217

Read more »

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

I want to Know what's the answer for this Problem And What's the technique to solve with ? http://codeforces.com/contest/842/problem/A

Read more »

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

I have Problem now in Codeforces when I submit solution for Problem it give me in queue I waited +13 minutes but it's also in queue Any Solution for this Problem ?

Read more »

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it

By MohamedAhmed04, history, 2 years ago, In English,

What's the needed Math for problem Solving What's necessary To learn in Mathematics in Algebra

Read more »

 
 
 
 
  • Vote: I like it
  • -12
  • Vote: I do not like it