### HieuNekodesu's blog

By HieuNekodesu, history, 12 days ago,

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

 » 11 days ago, # |   0 if this isn't fake i will never use a mac.
•  » » 11 days ago, # ^ |   0 It's not fake LOL, I just used this "feature" on macOS 13.0.1.
•  » » 11 days ago, # ^ |   0 Can confirm, it did restart when I compiled on sublime aswell xD
•  » » 11 days ago, # ^ |   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 :-(.
•  » » » 11 days ago, # ^ |   0 i use macbook air m1 with 8gb ram, may be m1 is the reason
•  » » » 11 days ago, # ^ |   0 You should use gcc compiler not clang.
 » 11 days ago, # |   +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)
 » 11 days ago, # | ← 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!
 » 11 days ago, # |   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.
•  » » 11 days ago, # ^ |   0 In addition, my computer has an 8GB physical memory. Maybe situations will be different on devices with a smaller memory.
•  » » » 11 days ago, # ^ |   0 i use air m1 with 8gb:((
 » 11 days ago, # | ← Rev. 2 →   0 Use Linux(arch btw) instead
 » 11 days ago, # |   0 This did happen with me too,in between a contest :(