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; const int N = 1024; int f[N], tmp[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int a; cin >> a; f[a]++; } for (int i = 1; i <= k; i++) { int countt = 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; const int N = 1e5 + 5; const int mod = 1e9 + 7; int a[N], mi[N], ma[N]; int main() { int n, k, x; scanf("%d%d%d", &n, &k, &x); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int i = 0; for (i = 1; i <= k; i++) { sort(a, a + n); mi[i] = a[0], ma[...
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 Codeshefcode{ public static void main(String[] args) throws IOException{ Solver Machine = new Solver() ; Machine.Solve() ; Machine.Finish() ; } } class Mod{ static long mod=1000000007 ; static long d(long a,long b){ return (a*ModInverse(b))%mod ; } stat...
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. ...
# by the authority of GOD author: manhar singh sachdev # import os,sys from io import BytesIO,IOBase def sort(a,b): cnt,out1,out2 = [0]*1024,[0]*1024,[0]*1024 for i in range(1024): cnt[i] += a[i]+b[i] z = 0 for ind,i in enumerate(cnt): if not i: continue if z: ...
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[2][(1 << 22)]; int n, k, x; int main() { scanf("%d %d %d", &n, &k, &x); int mx = 1023; for (register int i = 1; i <= n; i++) { int x; scanf("%d", &x); a[0][x]++; } int t = 0, cnt = 0; for (register int i = 1; i <= k; i++) { cnt = 0; for...
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 = 1000000000; const long long INF = 1LL * inf * inf; const double eps = 1e-9; const long long md = 1e9 + 7; const double EPS = 1e-5; const long long maxll = std::numeric_limits<long long>::max(); template <typename name> inline name sqr(name x) { return 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. ...
# Legends Always Come Up with Solution # Author: Manvir Singh import os import sys from io import BytesIO, IOBase def main(): n, k, x = map(int, input().split()) a = list(map(int, input().split())) ma = max(max(a),max(i^x for i in a)) b = [0] * (ma + 1) for i in a: b[i] += 1 for _ in r...
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.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.Map; import java.ut...
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 kunal05 */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class C768 { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); ...
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; using INT = long long; using VI = vector<int>; using pii = pair<int, int>; template <typename A, typename B> void smin(A &a, const B &b) { if (a > b) a = b; } template <typename A, typename B> void smax(A &a, const B &b) { if (a < b) a = b; } map<VI, int> mp; vector<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.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; public class C { public static void main(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. ...
import java.io.*; import java.math.*; import java.util.*; /** * JonSnowAndHisFavouriteNumber * @author: av-sharma */ public class JonSnowAndHisFavouriteNumber { public static void main(String[] args) { FastReader fr = new FastReader(); int n = fr.nextInt(); int k = fr.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; int q[1025], q2[1025]; vector<int> v; int main() { int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int num; cin >> num; if (not q[num]) v.push_back(num); q[num]++; } while (k--) { sort(v.begin(), v.end()); memset(q2, 0, sizeo...
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 C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput=""; void openInput(String file) { if(file==null)is = new BufferedReader(new InputStreamReader(System...
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 ''' import random la=100 a=[[]] for i in range(0,la):a[0].append(random.randint(1,1001)) x=random.randint(1,1001) print('x: ',x) a.sort() print('origin a',a[0]) ''' 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() fo...
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 f[2][1024]; int main() { int n, i, j, x, k, ma = 0; cin >> n >> k >> x; for (i = 0; i < n; i++) { int a; cin >> a; f[0][a]++; f[1][a]++; ma = max(ma, a); ma = max(ma, a ^ x); } ma = min(ma * 2, 1023); for (i = 0; i < k; i++) { 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. ...
# -*- coding: utf-8 -*- """ Created on Tue Aug 25 02:16:02 2020 @author: Dark Soul """ [n,k,x]=list(map(int, input().split())) arr=list(map(int, input().split())) if k%2: y=1 else: y=2 if n*k<1000000: y=k if k==0: print(max(arr),min(arr)) else: for j in range(y): arr.sort() for i 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 = 1e5 + 5; int n, k, x, y, counter = 0, cycle, sz; vector<int> v; map<vector<int>, int> vis; map<int, vector<int> > state; map<vector<int>, int> came; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> k >> x; for (int i = 0; i < 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. ...
import java.util.*; import java.io.*; import java.math.*; public class Practice { static FastReader sc=new FastReader(); static int mod=(int)Math.pow(10, 9)+7; public static void main(String[] args) { int ttt =1; //ttt=i(); PrintWriter out = new PrintWriter(Syste...
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; using namespace std; inline int iseven(int x) { return x & 1 ? 0 : 1; } inline bool is_double(double x) { double y = x - (int)x; return (y == x ? true : false); } long bigmod(long b, long p, long long m) { if (p == 0) return 1; if (p % 2 == 0) { return (long)pow...
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.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * @author Don Li */ public class JonSnowFavouriteNumber { void solve() { int n = in.nextInt(), k = in.nextInt(), x = in.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 long long inf = 1e15, mod = 1e9 + 7; int temp[1111]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k, cnt[1111], x; memset(cnt, 0, sizeof(cnt)); cin >> n >> k >> x; while (n--) { int xo; cin >> xo; cnt[xo]++; } for (int i = 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. ...
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n=sc.nextInt(); int k=sc.nextInt(); int x=sc.nextInt(); int []a=new int [n]; 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 double eps = 0.000000000000001; string convertstring(long long n) { stringstream ss; ss << n; return ss.str(); } int a[2][1026]; int main() { int n, k, p, i, j; scanf("%d%d%d", &n, &k, &p); ; for (i = 1; i <= n; ++i) { int x; scanf("%d", &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.*; import java.util.*; public class C { BufferedReader in; StringTokenizer st; PrintWriter out; String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine()); return st.nextToken(); } int nextInt() throws Exception { return Integer...
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. ...
from sys import stdin, stdout from collections import Counter, defaultdict from itertools import permutations, combinations raw_input = stdin.readline pr = stdout.write def in_num(): return int(raw_input()) def in_arr(): return map(int,raw_input().split()) def pr_num(n): stdout.write(str(n)+'\n') de...
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 NN = 1 << 10; using namespace std; int main() { int n, k, x; int M[NN], N[NN]; cin >> n >> k >> x; for (int index = 0; index < NN; index++) { M[index] = 0; N[index] = 0; } for (int index = 0; index < n; index++) { int tmp; cin >> tmp; M[tmp]++; } fo...
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.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
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; struct debugger { template <typename T> debugger &operator,(const T &v) { cerr << v << " "; return *this; } } dbg; inline long long gcd(long long a, long long b) { a = ((a) < 0 ? -(a) : (a)); b = ((b) < 0 ? -(b) : (b)); while (b) { a = a % b; swa...
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; int val[100005]; int f[2][1027]; int main() { scanf("%d%d%d", &n, &k, &x); int mx = x; for (int i = 1, t; i <= n; i++) scanf("%d", &t), f[0][t]++, mx = max(mx, t); for (int i = 1;; i <<= 1) { if (i > mx) { mx = i; break; } } 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.util.Arrays; import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author User */ public class R399 { public static void main(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; const int len = 2e3 + 10; const double pi = acos(-1.0); const long long mod = 1e9 + 7; const int inf = 0x3f3f3f3f; int n, k, x, num[2][len], a, mi, ma; int main() { cin >> n >> k >> x; mi = inf; ma = -inf; for (int i = 0; i < n; ++i) { scanf("%d", &a); ++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; int main() { int n, k, x; cin >> n >> k >> x; int *freq = new int[1500](); for (int i = 0; i < n; i++) { int xi; cin >> xi; freq[xi]++; } int *temp = new int[1500](); while (k--) { for (int i = 0; i < 1500; i++) { temp[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; inline void read1(int &x) { register int c = getchar(); x = 0; int neg = 0; for (; ((c < 48 || c > 57) && c != '-'); c = getchar()) ; if (c == '-') { neg = 1; c = getchar(); } for (; c > 47 && c < 58; c = getchar()) { x = (x << 1) + (x << 3) + ...
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 print(long long a[], int n) { cout << endl; for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl; } const int N = 1111; int db[2][N]; int main() { int n, k, x; scanf("%d%d%d", &n, &k, &x); int minn = 1 << 30; int maxx = -minn; 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. ...
import java.util.Scanner; public class Main { public static void main(String[] args) { // Write your code here Scanner sc = new Scanner(System.in); int numRangers = sc.nextInt(); int numOps = sc.nextInt(); int favNum = sc.nextInt(); int[] rangers = new int[numRangers]; ...
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 IEEE { public static void main(String[] args) throws IOException { //Scanner sc=new Scanner(System.in); BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ss=new StringTokenizer(r.readLine()); int n=Integer.pars...
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.io.IOException; import java.io.BufferedReader; import java.util.regex.Pattern; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution...
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 maxx = 1e5 + 10; int a[100][maxx]; int main() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, x, i, po, flag, flag3; while (cin >> n >> k >> x) { int maxn = -1; int minn = 9999999; for (int j = 0; j < n; j++) cin >> a[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. ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { FastScanner scan = new FastScanner(); PrintWriter out = ...
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() { long long n, k, x, i, j; long long freq[2][1024]; ios_base ::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); cin >> n >> k >> x; long long inp; for (i = 0; i < 1024; i++) freq[0][i] = 0; for (i = 0; i < n; i++) { cin >> inp; freq[...
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. ...
/* HARSH KHATRI DA-IICT */ import java.io.*; import java.util.*; import java.lang.*; import java.util.Scanner; import java.util.Arrays; import java.util.List; import java.util.ArrayList; public class CF768C { static FasterScanner in = new FasterScanner(); static 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 bisect from itertools import accumulate, count import os import sys import math from decimal import * 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 =...
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) { a = 0; int c = getchar(); while (c <= 32) c = getchar(); while (c >= '0' && c <= '9') a = a * 10 + c - '0', c = getchar(); return c; } inline int writeln(int a, int b) { return printf("%d %d\n", a, b); } int n, k, x; int a[1 << 17]; int 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. ...
import java.util.*; import java.io.*; public class Main { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String [] line = br.readLine().trim().split(" "); int n = Integer.parseInt(line[0]); int k = Integer.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. ...
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. ...
import java.io.*; import java.util.*; public class Main { static FastScanner in; static Map<Long, String> m = new HashMap<Long, String>(); public static void main(String[] args) throws IOException { // System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("nocross.out"...
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 = 1000000000; int data[100005]; int ada[2005]; int n, k, x; map<long long, int> dah; long long mod = 999999999989LL; void urut() { memset(ada, 0, sizeof(ada)); for (int(i) = (0); (i) <= (n - 1); ++(i)) ++ada[data[i]]; int now = 0; 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. ...
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") using namespace std; const int MAXN = 1033; int n, k, x; int ca[MAXN], cb[MAXN]; void go(int *fr, int *to) { int sum = 0, val, a, b; for (int i = 0; i < MAXN; i++) { val = i ^ x; a = fr[i] >> 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.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class R399P3 { public static int[] bestIndices; public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(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. ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; cin >> n >> k >> x; k = k % 1024; int a[n]; int b[n]; int m = INT_MAX; int M = INT_MIN; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < k; i++) { for (int j = 0; j < n; j += 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; const long long int big = 1000000009; vector<long long int> v; vector<long long int> v1; long long int f1 = 0, f2 = 0, ct = 0, ans = 0; long double pi = 3.14159265; int main(int argc, char *argv[]) { long long int n, k, x; scanf("%lld %lld %lld", &n, &k, &x); static 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. ...
/*Author: Satyajeet Singh, Delhi Technological University*/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; public class Main{ /*********************************************Constants******************************************/ static PrintWriter out=new PrintWriter(new OutputStreamWri...
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(0); int n, k, x, c; cin >> n >> k >> x; int vals[1025]; memset(vals, 0, sizeof(vals)); for (int i = 0; i < n; i++) { cin >> c; vals[c]++; } for (int i = 0; i < k; i++) { int flat = 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.util.*; import java.lang.*; import java.io.*; public class Main { void run() throws Exception { int n = nextInt(); int k = nextInt(); int x = nextInt(); int[][] xorarr = new int[1210][2]; for(int i = 0; i < n; i++) { xorarr[nextInt()][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. ...
import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; private static final Str...
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 Codeforces768C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() , k = sc.nextInt() , x = sc.nextInt(); int dp[] = new int[1200]; int temp[] = new int[1200]; for(int i = 0 ; i < n ; i++) { dp[sc.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. ...
from sys import stdin, stdout MOD = 10 ** 9 + 7 p = 137 def hashh(a): cnt = [0] for i in range(1, len(a) + 1): cnt.append((cnt[-1] * p + a[i - 1]) % MOD) return cnt[len(a)] n, k, x = map(int, stdin.readline().split()) values = sorted(list(map(int, stdin.readline().split()))) newvalues...
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; /** * Created by nischal.k on 02/10/16. */ public class Main { public static void main(String[] args) throws java.lang.Exception { ...
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.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.ObjectInputStream.GetField; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import ja...
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. ...
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package CP; import java.io.*; import java.util.*; public class C768 { public static void main(String args[])throws IOException ...
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 fre[2025], tmp_fre[2025]; int main() { ios::sync_with_stdio(false); int n, k, x, tmp; cin >> n >> k >> x; for (int i = 0; i < n; i++) { cin >> tmp; tmp_fre[tmp]++; } int cnt = 0, ind; for (int i = 0; i < k; i++) { cnt = 0; for (int j = 0; 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.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; import java.math.BigInteger; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; pu...
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.io.BufferedReader; import java.io.InputStream; ...
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 eps = 1e-8; const int mod = 1000000007; const double PI = acos(-1.0); int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int n, m; long long ans; int a[100005]; int b[2000]; int c[2000]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int 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. ...
import java.util.Scanner; public class JonSnow { public static void main(String[] args) { Scanner s=new Scanner(System.in); int N=100005; int[] freq=new int[1100]; int[] tmp=new int[1024]; int n,k,maxm=0,minm=Integer.MAX_VALUE,p,x; n=s.nextInt(); k=s.nextInt(); x=s.nextInt(); 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. ...
n,k,x = map(int,raw_input().split()) #r = sorted(map(lambda x:'0'*(10-len(bin(int(x)))+3)+bin(int(x))[2:],raw_input().split())) r = sorted(map(int,raw_input().split())) #print r p = [] p.append(r) for i in xrange(1,k+1): r1 = sorted([r[j]^x if j%2==0 else r[j] for j in xrange(n)]) #print r1 #print '-----' if r1 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. ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; while (t--) { int n, k, x; cin >> n >> k >> x; int count[1024] = {0}; for (int i = 0; i < n; i++) { int z; cin >> z; count[z]++; } 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. ...
# Legends Always Come Up with Solution # Author: Manvir Singh import os import sys from io import BytesIO, IOBase def main(): n, k, x = map(int, input().split()) a = list(map(int, input().split())) ma = max(max(a),max(i^x for i in a)) b = [0] * (ma + 1) for i in a: b[i] += 1 for _ in r...
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; int cuantos[2000]; int nextcuantos[2000]; int main() { cin >> n >> k >> x; for (int i = 1; i <= n; i++) { int y; cin >> y; cuantos[y]++; } int tope = 1 << 10; for (int paso = 0; paso < k; paso++) { int vistos = 0; for (int y = 0; 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. ...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); clock_t START; inline long double TIME() { return (long double)(clock() - START) / CLOCKS_PER_SEC; } void SHOW() { cout << fixed << setprecision(10); cout << TIME() << " SECONDS FROM START\n"; } 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; long long dif[1024], cou[1024], test[1024]; void f(int n, int k, int x, int a[]) { if (k == 0) { sort(a, a + n); cout << a[n - 1] << ' ' << a[0]; } else { for (int i = 0; i < n; i++) { cou[a[i]]++; } dif[0] = 0; for (int i = 1; i <= 1023; 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 MAX_N = 1024; int c[MAX_N], new_c[MAX_N]; int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; ++i) { int p; cin >> p; ++c[p]; } for (int i = 0; i < k; ++i) { memse...
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 cnt[3002][2]; int n, k, x; int t; int main() { cin >> n >> k >> x; for (int i = 0; i < n; i++) { cin >> t; cnt[t][0]++; } int cur = 0; for (int i = 0; i < k; i++) { int total = 0; for (int j = 0; j <= 1100; j++) { if (cnt[j][cur] > 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() { int n, k, x; cin >> n >> k >> x; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; k %= 64; while (k--) { sort(v.begin(), v.end()); for (int i = 0; i < n; i += 2) v[i] ^= x; } sort(v.begin(), v.end()); cout << v[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. ...
import java.util.*; public class Q1 { public static void main(String[] args) { // Write your code here Scanner in=new Scanner(System.in); int N=in.nextInt(),k=in.nextInt(),x=in.nextInt(); int arr[]=new int[1024],ano[]=new int[1024] ; for(int i=0;i<N;i++) 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. ...
#include <bits/stdc++.h> using namespace std; const int MAX_A = 1024; int acs[2][MAX_A]; int main() { int n, k, x; scanf("%d%d%d", &n, &k, &x); for (int i = 0; i < n; i++) { int ai; scanf("%d", &ai); acs[0][ai]++; } int cur = 0, nxt = 1; for (int i = 0; i < k; i++) { memset(acs[nxt], 0, size...
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; bool test = false; long long const N = 1e5 + 7; long long oo = 1000000007; vector<long long> v; vector<vector<long long> > vv; map<vector<long long>, long long> my; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long i, j, a, b, c, d = ...
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 cnt[1024]; int cnt2[1024]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; int mc = 1e4, bc = 0; for (int i = 0; i < n; i++) { int u; cin >> u; cnt[u]++; } while (k--) { 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. ...
from itertools import accumulate R = lambda: map(int, input().split()) n, k, num = R() cnts = [0] * 1025 for x in R(): cnts[x] += 1 for _ in range(k): nxt_cnts = [0] * 1025 acc = list(accumulate(cnts)) + [0] for i in range(1025): if cnts[i]: nxt = num ^ i if cnts[i] % 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. ...
import java.util.*; import java.io.*; import java.text.*; //Solution Credits: Taranpreet Singh public class Main{ //SOLUTION BEGIN void solve(int TC) throws Exception{ int n = ni(), k = ni(), x = ni(), b = 0; int[][] f = new int[1024][2]; for(int i = 0; i< n; i++)f[ni()][b]++; f...
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 gcd(long long int a, long long int b) { return b == 0 ? a : gcd(b, a % b); } long long power(long long a, long long b, long long MOD) { if (b < 0) return 0; long long ret = 1; while (b) { if (b % 2 == 1) ret = ret * a % MOD; a = a * a % MOD; ...
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()] p1, i = [], 0 while i < k: a.sort() p1 = a.copy() for j in range(0, n, 2): a[j] = a[j] ^ x if n * k > 1000000 and min(a) == p1[0] and max(a) == p1[-1]: break i += 1 print(max(a), min(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.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Abood2A { static ArrayList<Integer[]> prev; static Integer[] 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.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int oo = (int)1e9; static int mod = 1_000_000_007; static int[] di = {-1, 1, 0, 0}; static int[] dj = {0, 0, -1, 1}; static 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. ...
#include <bits/stdc++.h> using namespace std; int tmp[2050]; int mp[2050]; int main() { int n, k, x, y; scanf("%d", &n), scanf("%d", &k), scanf("%d", &x); for (int i = (0); i < (n); ++i) { scanf("%d", &y); mp[y]++; } for (int i = (0); i < (k); ++i) { for (int j = (0); j < (2050); ++j) { tmp[...
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 us[1100]; int us2[1100]; int main() { int ai, n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { cin >> ai; us[ai]++; } int j; int cur = 1; for (int i = 0; i < k; i++) { cur = 1; for (j = 0; j < 1100; j++) { if (!us[j]) contin...
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 n, k, x, ansx, ansy; long long z1, z2; long long a[100005], b[100005]; int main() { cin >> n >> k >> x; for (int i = 1; i <= n; ++i) cin >> a[i]; sort(a + 1, a + n + 1); ansx = -1; ansy = -1; for (int i = 1; i <= k; ++i) { z1 = b[1]; z2 = b[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> #pragma GCC optimize("O3") using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1e9 + 7; const int INF32 = 1e9 + 1e2; template <typename T> istream &operator>>(istream &a, vector<T> &v) { for (auto &first : v) a >> first; return a; } void stndrtn() {} const...
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 mod = 1e9 + 7; inline int mul(int x, int y) { return 1LL * x * y % mod; } int power_mod(int x, int y) { int ret = 1; while (y) { if (y & 1) ret = mul(ret, x); y >>= 1; x = mul(x, x); } return ret; } inline int read() { int x = 0, f = 1; char ch = getchar(); w...
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.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Random; import java.util.StringTokenizer; public class C { static 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.io.*; import java.util.*; public class C { public static void solution(BufferedReader reader, PrintWriter writer) throws IOException { In in = new In(reader); Out out = new Out(writer); int n = in.nextInt(), k = in.nextInt(), x = in.nextInt(); int[] a = new 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.Arrays; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at ...
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> #pragma comment(linker, "/STACK:256000000") using namespace std; const int MAXN = (int)1e5 + 7; const int MAXX = (int)5e5 + 7; const int INF = (int)1e9 + 7; const long long MOD = (long long)1e9; const long long LINF = (long long)1e18 + 7; void file() {} int k1[MAXN], k2[MAXN]; int main() { fi...
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> #pragma comment(linker, "/STACK:256000000") using namespace std; const int INF = (1 << 29) + 5; const long long int LLINF = (1ll << 59) + 5; const int MOD = 1000 * 1000 * 1000 + 7; const int MAX_X = 1024; int n, k, x; int arr[228228]; int cnt[2][MAX_X]; int main() { scanf("%d%d%d", &n, &k, &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. ...
#include <bits/stdc++.h> using namespace std; int n, k, x, v[100002]; int t; int frq[2][1026]; int ans1, ans2; void read() { scanf("%d %d %d", &n, &k, &x); for (int i = 1; i <= n; ++i) { scanf("%d", &v[i]); ++frq[0][v[i]]; } } void solve() { ans2 = -1; for (int i = 1; i <= k; ++i) { int s = 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; 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; } long long rem = k % 64; for (long long 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. ...
import java.io.*; import java.math.BigInteger; import java.util.*; public class Template implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws FileNotFoundException { try { in = new BufferedReader(new FileReader...
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 round_399_c { static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br); static PrintWriter out=new PrintWriter(System.out); static Random rnd=new Random(); static long mod=(long)(1e9+7); ...