当前位置:网站首页>Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) C. Jon Snow and his Favou
Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) C. Jon Snow and his Favou
2022-06-09 05:56:00 【No toast】
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
const int N = 1e5+2;
const int INF = 1<<30;
const int mod = 1e9+7;
int n,k,x,a[N];
map<uLL,int> mp;
uLL gethash(){
uLL now=0,p=13;
for(int i=1;i<=n;i++) now=now*p+(uLL)a[i];
return now;
}
pair<int,int> res[N];
void solve(){
scanf("%d%d%d",&n,&k,&x);
int maxi=0,mini=1e9,cnt=0,K=k;
for(int i=1;i<=n;i++) {
scanf("%d",&a[i]);
maxi=max(maxi,a[i]);
mini=min(mini,a[i]);
}
res[cnt]={
maxi,mini};
while(k--){
sort(a+1,a+1+n);
int maxi=0,mini=1e9;
for(int i=1;i<=n;i++){
if(i%2==1) a[i]^=x;
maxi=max(maxi,a[i]);
mini=min(mini,a[i]);
// cout<<a[i]<<" ";
}
// cout<<endl;
uLL now=gethash();
++cnt;
if(mp.count(now)==1){
int pre=mp[now],len=cnt-pre;
int nd=(K-pre)%len+pre;
// cout<<cnt<<endl;
// cout<<pre<<" "<<len<<" "<<nd<<endl;
// cout<<nd<<endl;
cout<<res[nd].first<<" "<<res[nd].second<<endl;
return;
}
res[cnt]={
maxi,mini};
mp[now]=cnt;
}
cout<<res[cnt].first<<" "<<res[cnt].second<<endl;
return;
}
int main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
- One side of a small company in Hangzhou
- Morsel-Driven Parallelism: 一种NUMA感知的并行Query Execution框架
- Jdbc-dbutils
- Data governance: how to improve enterprise data quality?
- How to monitor JVM GC
- debian11安装nfs server后固定端口号以便设置防火墙
- 代码签名证书的时间戳验证码签名方法
- Educational Codeforces Round 20 E. Roma and Poker
- After the SSL certificate is installed, the website still shows insecurity
- 线程thread 中join方法解读
猜你喜欢

Interpretation of join method in thread

From November 15, 2022, the private key of the code signing certificate shall be stored in the hardware encryption module

Enter two positive integers m and N to find their maximum common divisor and minimum common multiple.

MVCC多版本控制

Complete webrtc video recording in five minutes

CountDownLatch

Heqibao's trip to Chongqing ~

Gstreamer应用开发实战指南(三)

2022年11月15日起,代码签名证书私钥均需存储在硬件加密模块中

Complete jitsi meet guide for webrtc
随机推荐
pytorch with Automatic Mixed Precision(AMP)
2022年11月15日起,代码签名证书私钥均需存储在硬件加密模块中
Gstreamer应用开发实战指南(三)
Ctf: find the most collinear points in the point set
Swift extension
After the SSL certificate is installed, the website still shows insecurity
seaweedfs-client适配高版本的seaweedfs服务
Swift protocol
CEF 拦截URL,重定向新的网址
Two methods of unbutu installing ffmpeg
Painstakingly wrote a detailed MySQL tutorial of 24K words in three days, three nights
SSL证书包含了哪些信息?
Jitsi meet video recording with jibri
Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) C. Jon Snow and his Favou
Embedded audio and video solutions webrtc vs metartc
arthas-boot
Record TCP time once_ Blood cases caused by wait
Some concepts in network planning
Matlab - polynomial and function
和琪宝的重庆之旅~