Блог пользователя ReTai-Hieu

Автор ReTai-Hieu, история, 14 месяцев назад, По-английски

Watch this video first Video

#include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define endl '\n'
using namespace std;

const int maxN = 5000;
// const int maxN = 1e5 + 10;

int dp[maxN][maxN];

signed main(){
    //freopen("input.INP", "r", stdin);
    //freopen("output.OUT", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    return 0;
}

I use Macos Monterey 12.6.2, Command Line Tools for Xcode 14, and Homebrew GCC 12.2.0. When I declare the array too large, the machine will automatically restart. My question is is this a bug or a feature, because when I try it on Window 11 it still shows an error, not a restart. And as far as I know, when we restart the computer with code, we need admin permission sudo shutdown -r now but if we use this way, we don't need it.

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
14 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

if this isn't fake i will never use a mac.

  • »
    »
    14 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It's not fake LOL, I just used this "feature" on macOS 13.0.1.

  • »
    »
    14 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Can confirm, it did restart when I compiled on sublime aswell xD

  • »
    »
    14 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Actually, this may be fake. On my mac, when a program asks for a very large memory( I’ve just tested, for about 50 GB), it will be killed by the OS. Your experience may be because you’ve changed the settings, or you are running many programs, so your OS can’t deal with the situation. Then the OS crashed because there isn’t enough memory. Finally, it restart automatically :-(.

»
14 месяцев назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

it's not a bug, it's a feature for Apple computers to refuse to run anything that is not written in Swift (or Objective-C)

»
14 месяцев назад, # |
Rev. 2   Проголосовать: нравится +12 Проголосовать: не нравится

Instead of having a +10 minutes MLE penalty, now you will only have a +5 minutes penalty for restarting your mac. fair enough!

»
14 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

However, on my mac, the program with maxN=1e5+10 works normally. It seems that my computer will automatically kill programs which require too much memory, as I saw [1] 8735 killed /Users/…/xxx in the terminal when I ran a program.

»
14 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Use Linux(arch btw) instead