// Monday left me broken
// Tuesday I was through with hopin'
// Wednesday my empty arms were open
// Thursday waiting for love, waiting for love
// Thank the stars it's Friday
// I'm burning like a fire gone wild on Saturday
// Guess I won't be coming to church on Sunday
// I'll be waiting for love
// Waiting for love to come around
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define inf 0x3f3f3f3f
#define pi pair<long long int,long long int>
#define gcd(x,y) __gcd( x, y)
#define ALL(x) x.begin(),x.end()
#define pll pair<long long,long long>
#define debug(x) cerr<<#x<<':'<<x<<endl
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INTMAX 2147483647
#define INT_MAX LONG_LONG_MAX
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset; //upper_bound and lower_bound swap functions in multi
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set_ll;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset_ll;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
template<class K,class V> using ht = gp_hash_table<K,V,hash<K>,equal_to<K>,direct_mask_range_hashing<>,linear_probe_fn<>,hash_standard_resize_policy<hash_exponential_size_policy<>,hash_load_check_resize_trigger<>,true>>;
// scem unordered_map and unordered_set, to use umap use ht<ll,ll>, emplace doesnt exist so use .insert(), .reserve() is .resize(), to declare uset is ht<ll,null_type>, all other operations are same as regular
void solve() {
ll n, m, t1, t2; cin >> n >> m; ll ans = n*n;
unordered_map<ll, unordered_set<ll>> gay;
vector<pair<ll,ll>> valid_moves = {{2, -1}, {2, 1}, {-2, -1}, {-2, 1}, {1, -2}, {-1, -2}, {1, 2}, {-1, 2}};
for (ll q = 0; q < m; q++) {
cin >> t1 >> t2; t1--; t2--;
if (gay[t1].find(t2) == gay[t1].end()) {
gay[t1].insert(t2); ans--;
}
for (auto it: valid_moves) {
ll ny = it.first + t1, nx = it.second + t2;
if (ny >= n || nx < 0 || ny < 0 || nx >= n) continue;
if (gay[ny].find(nx) == gay[ny].end()) {
gay[ny].insert(nx); ans--;
}
}
}
cout << ans;
}
signed main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll tc=1;
//cin >> tc;
for (ll q = 0; q < tc; q++) {solve();}
}
Main.cpp:34: warning: "INT_MAX" redefined
34 | #define INT_MAX LONG_LONG_MAX
|
In file included from /usr/include/c++/12/climits:42,
from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:39,
from Main.cpp:10:
/usr/lib/gcc/x86_64-linux-gnu/12/include/limits.h:120: note: this is the location of the previous definition
120 | #define INT_MAX __INT_MAX__
|