| #include<bits/stdc++.h> |
| #define int long long |
| #define fi first |
| #define se second |
| #define pii std::pair<int,int> |
| #define eb emplace_back |
| #define pb push_back |
| typedef long long ll; |
| typedef unsigned long long ull; |
| std::mt19937 myrand(std::chrono::high_resolution_clock::now().time_since_epoch().count()); |
| inline int R(int n){return myrand()%n+1;} |
| inline int read(){char ch=getchar();int x=0,f=1;for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return x*f;} |
| const int N=1e6+10,mod=998244353,inf=1e9; |
| inline void Min(int &x,int y){if(x>y)x=y;} |
| inline void Max(int &x,int y){if(x<y)x=y;} |
| int cnt,n,q,a[N],b[N],w[N]; |
| signed main(){ |
| while(1){ |
| system("./rand"); |
| freopen("in.in","r",stdin); |
| system("./C"); |
| n=read(),q=read();for(int i=1;i<=n;++i)w[i]=read(); |
| for(int i=1;i<=q;++i){ |
| a[i]=read(),b[i]=read(); |
| } |
| freopen("out.out","r",stdin); |
| for(int i=1;i<=q;++i){ |
| int k=read(); |
| if(k<0)continue; |
| assert(((w[k]^a[i])-b[i])*((w[k+1]^a[i])-b[i])<=0); |
| } |
| std::cout<<"AC"<<++cnt<<'\n'; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| } |
| #include<bits/stdc++.h> |
| #define int long long |
| #define fi first |
| #define se second |
| #define pii std::pair<int,int> |
| #define eb emplace_back |
| #define pb push_back |
| typedef long long ll; |
| typedef unsigned long long ull; |
| std::mt19937 myrand(std::chrono::high_resolution_clock::now().time_since_epoch().count()); |
| inline int read(){char ch=getchar();int x=0,f=1;for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return x*f;} |
| const int N=1e6+10,mod=998244353,inf=1e9; |
| inline void Min(int &x,int y){if(x>y)x=y;} |
| inline void Max(int &x,int y){if(x<y)x=y;} |
| int n,Q,w[N]; |
| signed main(){ |
| freopen("in.in","r",stdin);freopen("std.out","w",stdout); |
| std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0); |
| n=read();Q=read();for(int i=1;i<=n;++i)w[i]=read(); |
| while(Q--){ |
| int a=read(),b=read(); |
| int res=0; |
| for(int i=1;i<=n;++i){if((w[i]^a)==b){res=i;break;}} |
| if(res){Min(res,n-1);std::cout<<res<<'\n';continue;} |
| for(int i=1;i<n;++i){if(((w[i]^a)-b)*((w[i+1]^a)-b)<0){res=i;break;}} |
| if(!res)res=-1; |
| std::cout<<res<<'\n'; |
| } |
| } |
| #include<bits/stdc++.h> |
| #define fi first |
| #define se second |
| #define pii std::pair<int,int> |
| #define eb emplace_back |
| #define pb push_back |
| typedef long long ll; |
| typedef unsigned long long ull; |
| std::mt19937 myrand(std::chrono::high_resolution_clock::now().time_since_epoch().count()); |
| inline int R(int n){return myrand()%n+1;} |
| inline int read(){char ch=getchar();int x=0,f=1;for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return x*f;} |
| const int N=2e5+10,mod=998244353,inf=1e9; |
| inline void Min(int &x,int y){if(x>y)x=y;} |
| inline void Max(int &x,int y){if(x<y)x=y;} |
| |
| signed main(){ |
| |
| freopen("in.in","w",stdout); |
| std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0); |
| int n=10000,q=10000; |
| std::cout<<n<<' '<<q<<'\n'; |
| for(int i=1;i<=n;++i)std::cout<<R(inf)<<' ';std::cout<<'\n'; |
| for(int i=1;i<=q;++i){ |
| std::cout<<R(inf)<<' '<<R(inf)<<'\n'; |
| } |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 【杂谈】分布式事务——高大上的无用知识?