QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545310#2670. Arranging shoesRegisterCompile Error//C++17906b2024-09-03 09:45:182024-09-03 09:45:19

詳細信息

answer.code: In function ‘int main()’:
answer.code:3:513: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | using namespace std;int n,tree[200001],a[200001];long long ans;vector<int>l[100001],r[100001];bool vis[200001];inline int read(){char ch=getchar();int res=0,w=1;while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}return res*w;}inline int lowbit(int x){return x&(-x);}inline void add(int p,int x){while(p<=(n<<1)){tree[p]+=x;p+=lowbit(p);}}inline int ask(int x){int res=0;while(x){res+=tree[x];x-=lowbit(x);}return res;}int main(){n=read();for(register int i=1,x;i<=(n<<1);i++){x=read();add(i,1);if(x<0)l[-x].push_back(i);else r[x].push_back(i);}for(register int i=1;i<=n;i++)for(register int j=0;j<l[i].size();j++){a[l[i][j]]=r[i][j];a[r[i][j]]=l[i][j];ans+=l[i][j]>r[i][j];}for(register int i=1;i<=(n<<1);i++)if(!vis[i]){add(i,-1);add(a[i],-1);ans+=ask(a[i]);vis[i]=vis[a[i]]=true;}printf("%lld\n",ans);return 0;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
answer.code:3:517: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | using namespace std;int n,tree[200001],a[200001];long long ans;vector<int>l[100001],r[100001];bool vis[200001];inline int read(){char ch=getchar();int res=0,w=1;while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}return res*w;}inline int lowbit(int x){return x&(-x);}inline void add(int p,int x){while(p<=(n<<1)){tree[p]+=x;p+=lowbit(p);}}inline int ask(int x){int res=0;while(x){res+=tree[x];x-=lowbit(x);}return res;}int main(){n=read();for(register int i=1,x;i<=(n<<1);i++){x=read();add(i,1);if(x<0)l[-x].push_back(i);else r[x].push_back(i);}for(register int i=1;i<=n;i++)for(register int j=0;j<l[i].size();j++){a[l[i][j]]=r[i][j];a[r[i][j]]=l[i][j];ans+=l[i][j]>r[i][j];}for(register int i=1;i<=(n<<1);i++)if(!vis[i]){add(i,-1);add(a[i],-1);ans+=ask(a[i]);vis[i]=vis[a[i]]=true;}printf("%lld\n",ans);return 0;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^
answer.code:3:619: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | using namespace std;int n,tree[200001],a[200001];long long ans;vector<int>l[100001],r[100001];bool vis[200001];inline int read(){char ch=getchar();int res=0,w=1;while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}return res*w;}inline int lowbit(int x){return x&(-x);}inline void add(int p,int x){while(p<=(n<<1)){tree[p]+=x;p+=lowbit(p);}}inline int ask(int x){int res=0;while(x){res+=tree[x];x-=lowbit(x);}return res;}int main(){n=read();for(register int i=1,x;i<=(n<<1);i++){x=read();add(i,1);if(x<0)l[-x].push_back(i);else r[x].push_back(i);}for(register int i=1;i<=n;i++)for(register int j=0;j<l[i].size();j++){a[l[i][j]]=r[i][j];a[r[i][j]]=l[i][j];ans+=l[i][j]>r[i][j];}for(register int i=1;i<=(n<<1);i++)if(!vis[i]){add(i,-1);add(a[i],-1);ans+=ask(a[i]);vis[i]=vis[a[i]]=true;}printf("%lld\n",ans);return 0;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
answer.code:3:649: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | using namespace std;int n,tree[200001],a[200001];long long ans;vector<int>l[100001],r[100001];bool vis[200001];inline int read(){char ch=getchar();int res=0,w=1;while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9')...