以下が自分が普段使ってるC++用の必要最低限のテンプレートになります。
その他の関数 chmin()やchmax()等は別でスニペットにしてライブラリとして持っています。(短いほうが綺麗で精神衛生上良いので。)
# include<bits/stdc++.h>
using ll= long long;
# define REP(i,n) for(ll i=0;i<ll(n);i++)
# define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
# define ALL(x) x.begin(),x.end()
# define INF (int)1e9 //10^9:∞
# define LLINF (long long)1e12
# define MOD (int)1e9+7 //10^9+7:合同式の法
# define PI 3.141592653589
# define PB push_back
# define F first
# define S second
# define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);
# define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
# define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
# define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
# define Graph vector<vector<int>>
# define PII pair<int,int>
# define VI vector<int>
# define VVI vector<vector<int>>
# define VPII vector<pair<int,int>>
# define DDD fixed<<setprecision(10)
using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/
/*.....................DEFINE FUNCTIONS ......................*/
/*.........................kemkemG0...........................*/
signed main() {
__MAGIC__
return 0;
}
見てほしいポイントは、
# define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);
ですね笑
入出力高速化のおまじないですがなんとなくマクロにしてます笑