Run this `O(n^2)` program in CF custom test↵
↵
~~~~~↵
#include "bits/stdc++.h"↵
using namespace std;↵
↵
long long n;↵
↵
int main() {↵
cin >> n;↵
for(long long i = 1; i <= n; i++) {↵
for(long long j = 1; j <= n; j++) {↵
if((i ^ j) == 0) {↵
if(i != j) {↵
cout << "NO!\n";↵
return 0;↵
}↵
}↵
}↵
}↵
cout << "YES\n";↵
}↵
~~~~~↵
↵
with `n = 100000000000`↵
↵
You would expect it to be much longer than 1 second, but it takes↵
↵
`15 ms`↵
↵
[screenshot](https://imgur.com/a/OTNWR9I)
↵
~~~~~↵
#include "bits/stdc++.h"↵
using namespace std;↵
↵
long long n;↵
↵
int main() {↵
cin >> n;↵
for(long long i = 1; i <= n; i++) {↵
for(long long j = 1; j <= n; j++) {↵
if((i ^ j) == 0) {↵
if(i != j) {↵
cout << "NO!\n";↵
return 0;↵
}↵
}↵
}↵
}↵
cout << "YES\n";↵
}↵
~~~~~↵
↵
with `n = 100000000000`↵
↵
You would expect it to be much longer than 1 second, but it takes↵
↵
`15 ms`↵
↵
[screenshot](https://imgur.com/a/OTNWR9I)