快读
inline int read()
{
int x=0,f=1;char ch=getchar_unlocked();
for(;ch<'0'||ch>'9';ch=getchar_unlocked())if(ch=='-')f=-1;
for(;ch>='0'&&ch<='9';ch=getchar_unlocked())x=(x<<3)+(x<<1)+(ch^48);
return x*f;
}
诸如此类__builtin_printf,__builtin_scanf
还有解绑\(cin,cout\),#define speed() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
三位运算符,优化\(if\)语句(条件)?op1:op2
卡常题U438090 [SUMMER STU] First Zero (Hard Version)
#include <bits/stdc++.h>
#define speed() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ll long long
#define pb push_back
#define ull unsigned long long
#define pii pair<int,int>
#define lid (rt<<1)
#define rid (rt<<1|1)
using namespace std;
const int N = 5e6+5;
int n,pre[N],nxt[N];
inline int read()
{
int x=0,f=1;char ch=getchar_unlocked();
for(;ch<'0'||ch>'9';ch=getchar_unlocked())if(ch=='-')f=-1;
for(;ch>='0'&&ch<='9';ch=getchar_unlocked())x=(x<<3)+(x<<1)+(ch^48);
return x*f;
}
inline void write(int x)
{
return x?write(x/10),putchar_unlocked((x%10)|'0'),void(0):void(0);
}
int main()
{
// freopen("in.in","r",stdin);
// freopen("out.out","w",stdout);
register int pos;
n=read();
for(register int i=1;i<=n+1;i=-~i)pre[i]|=i-1,nxt[i]|=i+1;
for(register int i=1;i<=n-1;i=-~i)
{
pos=read();
nxt[pre[pos]]=nxt[pos];
pre[nxt[pos]]=pre[pos];
nxt[pos]==n+1?(putchar('-'),putchar('1'),void(0)):(write(nxt[pos]));
putchar_unlocked('\n');
// __builtin_printf("%d\n",(nxt[pos]==n+1?-1:nxt[pos]));
}
return 0;
}
标签:ch,技巧,cout,long,卡常,tie,getchar,define
From: https://www.cnblogs.com/wlesq/p/18357126