prompt
string
response
string
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; vector<int> a, b, c; int n, k, x; int main() { ios_base::sync_with_stdio(false); scanf("%d %d %d", &n, &k, &x); int t; for (int i = 0; i < 1050; i++) { a.push_back(0); b.push_back(0); c.push_back(0); } for (int i = 0; i < n; i++) { scanf("%d", &t...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T BMOD(T p, T e, T m) { T ret = 1; while (e) { if (e & 1) ret = (ret * p) % m; p = (p * p) % m; e >>= 1; } return (T)ret; } template <class T> inline T MODINV(T a, T m) { return BMOD(a, m - 2, m); } template <class T> inline T...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long long int INF = 1e17; long long int c1[1025] = {0}, c2[1025] = {0}; int main() { ios_base::sync_with_stdio(0); long long int n, i, j, k, l, x; long long int N = 1025; cin >> n >> k >> x; long long int a[n]; for (i = 0; i < n; i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
//package baobab; import java.io.*; import java.util.*; public class C { public static void main(String[] args) { Solver solver = new Solver(); } static class Solver { IO io; public Solver() { this.io = new IO(); try { solve(); ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
n,k,x=[int(i) for i in input().split()] a=[int(i) for i in input().split()] n1=[] n2=[] p=True from sys import exit if n==74 and k==361: print(987,39) exit() if k==0: print(max(a),min(a)) exit() elif k<100 and n<200: for i in range(k): a.sort() for j in range(0,n,2): ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; long long int a[1026]; long long int b[1026]; int main() { long long int n, k, p, sum, l, t, ans, r, z, m, f, i, j; long long int *x, *y; x = a; y = b; cin >> n >> k >> p; for (i = 1; i <= n; i++) { cin >> t; x[t]++; } for (j = 0; j < int(k); j++) { ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int occs[2][1024]; int main() { int nbSoldats, nbEtapes, nombre; cin >> nbSoldats >> nbEtapes >> nombre; for (int iSoldat = 0; iSoldat < nbSoldats; iSoldat++) { int force; cin >> force; occs[0][force]++; } for (int iEtape = 0; iEtape < nbEtapes; iEtape...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int *A, *B, *C, D[1025], E[1025], t, n, k, x; int main() { memset(D, 0, sizeof D); memset(E, 0, sizeof E); scanf("%d%d%d", &n, &k, &x); A = D; B = E; for (int i = 1; i <= n; i++) { scanf("%d", &t); A[t]++; } while (k--) { for (int i = 0, s = 0; i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
n,k,x=map(int,input().split()) s=list(map(int,input().split())) if k==0: k=0 else: k%=64 while k: s=sorted(s) for i in range(0,n,2): s[i]^=x k-=1 print(max(s),min(s))
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.*; import java.util.*; import java.util.Map.Entry; public class TestClass { private static InputStream stream; private static byte[] buf = new byte[1024]; private static int curChar; private static int numChars; p...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; cin >> n >> k >> x; int freq1[1024], freq2[1024]; memset(freq1, 0, sizeof freq1); int z; for (int i = 0; i < n; i++) { cin >> z; freq1[z] += 1; } for (int i = 1; i <= k; i++) { memset(freq2, 0, sizeof freq2); int cou...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int arr[1024] = {0}; int b[1024] = {0}; int main() { int n, k, x, val, count = 0; cin >> n >> k >> x; for (int i = 0; i < n; i++) { cin >> val; arr[val]++; b[val]++; } for (int j = 0; j < k; j++) { count = 0; for (int i = 0; i < 1024; i++) { ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int freq[1100], tmp[1024]; int main() { int n, k, maxm = 0, minm = INT_MAX, p, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) cin >> p, freq[p]++; for (int i = 0; i < k; i++) { for (int j = 0; j < 1024; j++) tmp[j] = freq[j]; int par = 0; for (int j ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; // InputStream inputStream = new FileInputStream("dijkstra.in"); OutputStream outputStream = System.out; // OutputStream outputStr...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { static StringTokenizer st; static BufferedReader br;...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
inp = [ (10, 10, 98) ,(1, 58, 62, 71, 55, 4, 20, 17, 25, 29) ] read = lambda: tuple(map(int, input().split())) n, k, x = read() l = sorted(read()) if k > 10: k = k % 4 + 4 for i in range(k): l = sorted([l[j] ^ x if j % 2 == 0 else l[j] for j in range(0, len(l), 1)]) print(max(l), min(l))
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, k, x, tt = 0; int a[N], b[N]; int main() { scanf("%d %d %d", &n, &k, &x); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= k; i++) { sort(a + 1, a + n + 1); int maxi = a[n]; int mini = a[1]; if ((i >=...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
/* Author- Ayub Subhaniya Institute- DAI-ICT */ import java.util.*; import java.io.*; public class Driver { static int MAX=1025; public static void main(String[] args){ FastScanner in = new FastScanner(); OutputWriter out = new OutputWriter(System.out); int n=in.nextInt(); int k=in.nextInt(); int x=i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k, x, *a; cin >> n >> k >> x; a = new long long[n]; long long val[1024] = {0}; int temp[1024] = {0}; for (long long i = 0; i < (n); i++) { cin >> a[i]; val[a...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class JonSnowandhisFavouriteNumber { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in)...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
//Codeforces Round 399 import java.io.*; import java.util.*; public class TaskC { public static void main (String[] args) throws IOException { FastScanner fs = new FastScanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = fs.nextInt(); int k = fs.nextInt(); int x = fs.nextInt(); ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import math freq=[0]*1026 temp=[0]*1026 n,k,x=map(int,raw_input().split()) a=map(int,raw_input().split()) for i in range(n): freq[a[i]]=freq[a[i]]+1 for j in range(k): for i in range(1025): temp[i]=freq[i] par=0 for i in range(1025): if(freq[i]>0): cur=i^x change=...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#!/usr/bin/env python3 from sys import stdin,stdout def ri(): return map(int, input().split()) n, k, x = ri() a = [] a.append(list(ri())) t = 0 j = 0 goout = 0 for j in range(0,k): a[j].sort() if j != 0: for t in range(j): if a[t] == a[j]: goout = 1 br...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int a[1 << 10][2]; int arr[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k, x; cin >> n >> k >> x; memset(a, 0, sizeof(a)); int limit = 1 << 10; int cur = 0, oth = 1; for (int i = 1; i <= n; i++) { cin >>...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int arr1[1024], arr2[1024]; int *old, *next; old = arr1; next = arr2; int n, k, x, z; cin >> n >> k >> x; fill(old, old + 1024, 0); for (int i = 0; i < n; i++) { scanf("%d", &z); old[z]++; } bool take; while (k--) { take = true...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; /** * Road to 1600 raiting */ public class Main { static class Task { PrintWriter out; int[] xor = new int[1025]; int[] a1 = new int[1025]; int[] a2 = new int[1025]; public void solve(MyScanner in, PrintWriter out) { this...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int maxn = 1e5 + 7; int a[maxn], maxx[maxn], minn[maxn]; int main() { int n, k, x; cin >> n >> k >> x; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); maxx[1] = a[n]; minn[1] = a[1]; for (int i = 1; i <...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; public class R399qC { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); int b = 10; int N = 1 << ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5; int a[N], b[N], n, k, x; int main() { cin >> n >> k >> x; for (int i = 1; i <= n; i++) { int y; scanf("%d", &y); a[y]++; } for (int i = 0; i < k; i++) { int sum = 0; for (int j = 0; j < 1024; j++) { if (a[j]) { if...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class codeforces { static class Student{ int x,y;//z; Student(int x,int...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int n, k, x, b; int t[2][2010]; int main() { scanf("%d%d%d", &n, &k, &x); for (int i = 1, w; i <= n; i++) scanf("%d", &w), t[1][w]++; b = 0; while (k--) { int cnt = 0; b ^= 1; for (int i = 0; i <= 2000; i++) t[b ^ 1][i] = 0; for (int i = 0; i <= 2000...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
# ------------------- fast io -------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file....
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Map; import java.io.BufferedReader; import ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.*; import java.io.*; public class TestClass{ static InputReader sc = new InputReader(); public static void main(String[] args) throws IOException{ int[] fre=new int[1024]; int n=i(); int k=i(); int x=i(); int[] a=new int[n]; int[] mml=new int[1024]...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int a[100005], b[100005]; map<pair<long long, long long>, int> m; long long p = 166425813649LL; long long q = 73727170696867LL; int main() { std::ios_base::sync_with_stdio(0); int cases, caseno = 0, n, i, j, k, x, t; bool damn = 0; long long sum, cnt; cin >> n >> ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; inline int read(int& a) { return scanf("%d", &a); } inline int writeln(int a, int b) { return printf("%d %d\n", a, b); } int n, k, x; int a[1 << 17]; int main() { read(n); read(k); read(x); for (int i = 0; i < n; ++i) read(a[i]); k = k % 64; for (int i = 0; i < ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
# ---------------------------iye ha aam zindegi--------------------------------------------- import math import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction mod = 10 ** 9 + 7 mod1 = 998244353 # ------------------------------warmup---------------------------- import...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.Arrays; import java.util.Scanner; import java.util.TreeMap; public class CF768C { static TreeMap<String, Integer> map; public static void main(String[] args) { Scanner sc= new Scanner(System.in); // System.out.println(11 ^4); // System.out.println(13 ); // System.out.println(23 ^ 4); // Sys...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int inf = 1000 * 1000 * 1000 + 7; const int num = 1000 * 1000 + 7; const int N = 2000 + 7; int a[num], b[num]; bool f[num]; vector<int> g[N]; map<int, int> ma; long long ans; int main() { int i, j, k, l, r, n, m, x; string s, s1; cin >> n >> k >> x; for (int i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; int a[1031][2] = {0}; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int y; cin >> y; a[y][0]++; } int ok = 0; int last = 1; for (int j = 0; j < k; j++) { last = 1; for (int i = 0; i <= 1030; i++) { if (...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.Scanner; public class c { public static int MAX = 1024; public static void main(String[] args) { Scanner reader = new Scanner(System.in); int N = reader.nextInt(); int K = reader.nextInt(); int x = reader.nextInt(); int[][] wys = new int[MAX][2]; int last = 0, minimal = MAX, maks ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; cin >> n >> k >> x; int temp[1500] = {0}; for (int i = 0; i < n; i++) { int x1; cin >> x1; temp[x1]++; } int freq[1500] = {0}; for (int i = 0; i < 1500; i++) { freq[i] = temp[i]; } while (k--) { int p = 0; ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, k, x; cin >> n >> k >> x; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (k == 0) { cout << a[n - 1] << " " << a[0] << "\n"; return; } k %= 64; for (long long i = 0; i < k; i++) { s...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class ProblemC { static int SIZE = 2500; public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.Arrays; import java.util.Scanner; public class P768C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), x = sc.nextInt(); int max = 0, min = 1100; int[] arr = new int[1100]; for(int i = 0 ; i < n ; i++) { arr[sc.n...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int podch[1100]; int newp[1100]; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; podch[tmp]++; } for (int i = 0; i < k; i++) { int count...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; public class Main { public static void main(String[] args) throws Exception { new Main().solve(); } int inf = 2000000000; int mod = 1000000007; double eps = 0.00...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); long long n, x, y, k; cin >> n >> k >> x; vector<long long> v; for (int i = 0; i < n; i++) { cin >> y; v.push_back(y); } if (k > 96) { long long times = min(k, 96LL); k = k % 96;...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1E9 + 7; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3f; long long qmod(long long a, long long b, long long c) { long long res = 1; a %= c; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % c; a = a ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C2 { static PrintWriter out = new PrintWriter(new BufferedOu...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
R = lambda: map(int, raw_input().split()) N=1028 n,k,x=R() c=[0]*N for y in R(): c[y]+=1 d=[1]*N for _ in range(k): for i in range(N-1): d[i+1]=d[i]^(c[i]%2) for i in range(1001): j=i^x if i<=j and (c[i] or c[j]): u,v=(c[i]+d[i])/2,(c[j]+d[j])/2 c[i],c[j]=c[i]-u+v,c[j]-v+u t=[x for x in ra...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class CTask { public static void main(String[] args) throws IOException { MyInputReader in = new MyInputReader(System.in); int n = in.nextInt(); ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFF = 0x3f3f3f3f3f3f3f3f; const long long M = 1e9 + 7; const long long N = 3e6 + 7; const double eps = 0.00000001; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } template <typename T> inline T abs(T a, ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int freq[1100], aux[1100]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x, r, par, maxi, mini; cin >> n >> k >> x; for (int i = 0; i < n; i++) cin >> r, freq[r]++; while (k--) { for (int i = 0; i < 1024; i++) aux[i] = freq[i]; ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; vector<int> A; cin >> n >> k >> x; for (int index = 0; index < n; index++) { int tmp; cin >> tmp; A.push_back(tmp); } k %= 64; for (int index = 0; index < k; index++) { sort(A.begin(), A.end()); for (int index = 0;...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; inline void boost() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); } const int MXN = 1e5 + 5; int n, k, x, a[MXN], f[1025], c[1025]; int main() { boost(); cin >> n >> k >> x; for (int i = 1; i <= n; i++) cin >> a[i], f[a[i]]++; while (k--) { for (i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; public class C { public static void main(String[] args) throws Exception { FastScannerC fs = new FastScannerC(); PrintWriter out = new PrintWriter(System.out); int n = fs.nextInt(), k= fs.nextInt(), x = fs.nextInt(); int[] a= fs.nextIntArray(n)...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int N = 1100; const int mod = 1e9 + 7; int cnt[N], fre[N]; int mn, mx; int main() { ios::sync_with_stdio(false); int n, k, x; cin >> n >> k >> x; mn = mod; for (int i = 0; i < n; i++) { int y; cin >> y; cnt[y]++; fre[y]++; } for (int i = ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int MOD = 95542721; const int INF = 1e9 + 7; const long long INF64 = 2e18; const long double EPS = 1e-16; const long long MD = 1551513443; const int N = 100001; const int M = 1025; const int DEBUG = 400; const int MAGIC = 320; int n, k, first, a[M], b[M]; int main() {...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int n, k, x, t = 0, s = 1; const int maxn = 2e3 + 5; int f[2][maxn]; int main() { cin >> n >> k >> x; for (int i = 0; i < n; ++i) { int x; cin >> x; f[t][x]++; } for (int i = 0; i < k; ++i) { for (int j = 0; j < maxn; ++j) f[s][j] = 0; int num = ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; const int N = 1e5 + 7; const int MAX = 1e9 + 1; int n, k, x; int mp[1024]; int mpT[1024]; int main() { int i, j; cin >> n >> k >> x; for (i = 0; i < n; ++i) { int t; cin >> t; ++mp[t]; } for (i = 0; i < k; ++i) { bool f = tru...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class c { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(InputStream in) { br = new...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#coding utf-8 s=input().split(); n=int(s[0]);k=int(s[1]);x=int(s[2]); a=[[]] s=input().split(); for i in range(n): a[0].append(int(s[i])); a[0].sort() for i in range(1,k+1): a.append([a[i-1][t]^(x*((t+1)%2)) for t in range(len(a[i-1]))]) a[i].sort() for t in range(i): if a[i]==a[t]: flag=True break if(t!...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const double mod = 1e9 + 7; long long int msum(long long int a, long long int b, long long int m) { return (a % m + b % m) % m; } long long int msub(long long int a, long long int b, long long int m) { return (a % m - b % m) % m; } long long int mpro(long long int a, lo...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
n,k,x = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] if k!=0: k = k%64 else: k=0 while k: arr.sort() for i in range(0,n,2): arr[i] ^= x k-=1 print(max(arr),min(arr))
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static InputReader in; public static PrintWriter pw; public static void main(String args[]) { new Thread(null, new Runnable() { public void run() { try{ solv...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1035; #pragma GCC Optimize("Ofast") int a[2][maxn]; int main() { int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int num; cin >> num; a[0][num]++; } int o = 1, O = 0; for (int i = 0; i < k; i++) { o = (i % 2), O = ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.System.exit; import static java.util.Arrays.fill; import java.io.BufferedReader; import java.io.IOExc...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Check2 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numC...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringToke...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> const int N = (int)4e3 + 228; using namespace std; int n, a[N], new_a[N], k, x; int main() { scanf("%d%d%d", &n, &k, &x); for (int i = 1; i <= n; i++) { int y; scanf("%d", &y); a[y]++; } for (int i = 1; i <= k; i++) { int cur = 0; for (int j = 0; j <= 4000; j++) { ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; void solve(), solve1(); void gen(); int main() { srand((unsigned int)time(0)); ios::sync_with_stdio(0); cin.tie(0); ; solve(); return 0; } long long mod = 1e9; long long inf = 2 * 1e18; void solve() { long long n, k, x; cin >> n >> k >> x; vector<long long...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x, a[100005]; cin >> n >> k >> x; for (int i = 0; i < n; i++) cin >> a[i]; k %= 64; while (k--) { sort(a, a + n); for (int j = 0; j < n; j += 2) a[j] ^= x; } sort(a, a + n); cout << a[n - 1] << " " << a[0] << endl; return 0; ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k, x; cin >> n >> k >> x; int a[1024], prefixSum[1024]; memset(a, 0, sizeof(a)); memset(prefixSum, 0, sizeof(prefixSum)); for (int i = 0; i < n; i++) { int y; cin >> y; a[y]++; } ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; void printVector(vector<string> &v) { for (auto x : v) cout << x << "\n"; } void printVector(vector<int> &v) { for (auto x : v) cout << x << " "; cout << "\n"; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int t; t = 1; while (t--) { ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.util.Arrays; import java.util.Scanner; import java.util.TreeMap; public class CF768C { static TreeMap<String, Integer> map; public static void main(String[] args) { Scanner sc= new Scanner(System.in); // System.out.println(11 ^4); // System.out.println(13 ); // System.out.println(23 ^ 4); // Sys...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; cin >> n >> k >> x; int a[1025]; int b[1025]; memset(a, 0, sizeof(a)); for (int i = 0; i < n; i++) { int u; cin >> u; a[u]++; } for (int i = 0; i < k; i++) { int flag = 1; memset(b, 0, sizeof(b)); for (int j ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k, x; cin >> n >> k >> x; int cont[1025]; for (int i = 0; i < 1025; i++) cont[i] = 0; for (int i = 0; i < n; i++) { int b; cin >> b; cont[b]++; } int cont2[1025]; for (int i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
//package clipse; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; imp...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); long long n, x, y, k; cin >> n >> k >> x; vector<long long> v; for (int i = 0; i < n; i++) { cin >> y; v.push_back(y); } if (k > 100) { long long times = min(k, 100LL); k = k % 1...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; //PrintWriter import java.math.*; //BigInteger, BigDecimal import java.util.*; //StringTokenizer, ArrayList public class R399_Div2_C { FastReader in; PrintWriter out; public static void main(String[] args) { new R399_Div2_C().run(); } void run() { in = new FastReader(System.in...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.*; import java.util.List; public class B implements Runnable { private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private Buffered...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
n,k,x=map(int,raw_input().split()) lst=map(int,raw_input().split()) #from collections import * #ck=Counter(lst) #fv=[0]*(2049) #for i in lst: #fv[i]=fv[i]+1 pc={} from copy import deepcopy v=deepcopy(k) k=min(k,256+k%128) while k>0 : #t=[] #for i in ck: # t.append([i,ck[i]]) lst.sort() for i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 50; const int X = 1024; int n, k, x; int arr[N]; int freq[X], freq2[X]; inline void brute() { int seen_till = 0; for (int i = 0; i < X; i++) { if (freq[i] != 0) { if (!seen_till) { int dec = (freq[i] + 1) / 2; freq2[i ^ x...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class C { static final int INF = (int)1e9+7; int N,K,X; int[] a,b; public void solve() { N = nextInt(); K = nextInt(); X = nextInt(); a = new int[N]; for(int i = 0;i < N;i+...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
def main(): # Handle input first_line = input() second_line = input() n, k, x = map(int, first_line.split()) rangers = list(map(int, second_line.split())) # Store val^x for all possible values xor_results = get_xor_results(x) # Apply transformation operation to rangers (max) k times ...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int a[1100], b[1100]; int main() { int i, j, n, k, x; cin >> n >> k >> x; int arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; a[arr[i]]++; } for (j = 0; j < k; j++) { int sum = 0; for (i = 0; i < 1100; i++) { if (a[i] > 0) { if (a[...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokeniz...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
//package org.javadov.codeforces.contest; import java.io.*; import java.util.*; /** * Created by asgar on 2/20/17. */ public class TaskC { public void solve(int testNumber, FastScanner in, FastWriter out) throws IOException { int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import random import time seed = int(0) random.seed(seed) def solve_slow(n, k, x, xs): ys = [z for z in xs] for _ in range(1, k+1): #print _-1, ys ys = sorted(ys) for i in range(0, n, 2): ys[i] = ys[i] ^ x #print _, ys #print return '%d %d' % (max(ys), m...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; inline namespace Infinity { inline namespace Constant { constexpr const int eof = EOF; constexpr const int maxint = INT_MAX; constexpr const long long maxll = LLONG_MAX; constexpr const double eps = DBL_EPSILON; } // namespace Constant inline namespace TypeDefine { using u...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; public final class TaskC { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(in, out); solver.solve(); in.close(); out.flush()...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void rread(T& num) { num = 0; T f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getchar(); num *= f; } inline i...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
import java.io.*; import java.util.*; import java.util.Arrays; import java.math.*; import static java.lang.Math.min; import static java.lang.Math.max; public class _399div2Q3 { public static void main(String[] args) throws IOException { FastScanner obj = new FastScanner(); out = new PrintWrit...
Problem: Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. ...
#include <bits/stdc++.h> using namespace std; int inf = 2147483647; const long long ll = 9223372036854775807; int A[100005] = {}; int main() { int a, b, c; while (cin >> a >> b >> c) { int B[2030] = {}, C[2334] = {}; for (int i = 0; i < a; i++) { cin >> A[i]; B[A[i]]++; } int now = 0, ma...