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.
if this isn't fake i will never use a mac.
It's not fake LOL, I just used this "feature" on macOS 13.0.1.
Can confirm, it did restart when I compiled on sublime aswell xD
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 :-(.
i use macbook air m1 with 8gb ram, may be m1 is the reason
You should use gcc compiler not clang.
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)
Instead of having a +10 minutes MLE penalty, now you will only have a +5 minutes penalty for restarting your mac. fair enough!
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.In addition, my computer has an 8GB physical memory. Maybe situations will be different on devices with a smaller memory.
i use air m1 with 8gb:((
Use Linux(arch btw) instead