IF-THEN's blog

By IF-THEN, history, 4 years ago, In English

What doe the following code mean ? Why use it ?

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

Full text and comments »

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

By IF-THEN, history, 5 years ago, In English
bool dfs(int r, int c) {
    if (r > n || c > m || vis[ndx(r, c)] || grid[ndx(r,c)] == '#') return false;
    if (r == n && c == m) return true;
    if (r!=1 || c!=1) vis[ndx(r, c)] = true;
    return dfs(r+1, c) || dfs(r, c+1);
}

Why Does the previous code terminate once a call is evaluated as true ?

In other words, Why it doesn't mark each reachable cell that does not have "#", as expected ?

Full text and comments »

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

By IF-THEN, history, 5 years ago, In English

How can I find all Div 3 contests ?

Full text and comments »

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

By IF-THEN, history, 5 years ago, In English

When I choose Clang++17 Diagnostics and submit this solution, The verdict is TLE. But

when I choose any GNU G++ and submit the exact same code, It's Accepted.

why ?

Full text and comments »

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