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. ...
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. ...
# -*- coding: utf-8 -*- # @Author: HaonanWu # @Date: 2017-02-25 11:12:05 # @Last Modified by: HaonanWu # @Last Modified time: 2017-02-25 12:01:23 import copy def check(arr, a, cnt, n): flag = True for i in range(cnt): flag = True for j in range(n): if a[j] != arr[i][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.util.*; /** * Created by abgupta on 2/20/17. */ public class Favorite { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); int[] a = readIntArray(in, n); 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; int counter[2003] = {0}, counter2[2003] = {0}; int main() { int n, tillcount, k, x, i, j, ele; cin >> n >> k >> x; for (i = 0; i < n; i++) { cin >> ele; counter[ele] += 1; } for (j = 0; j < k; j++) { tillcount = 0; for (i = 0; i < 2002; 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 i, j, n, k, x, y, freq[3005], aux[3005]; int main() { ios_base::sync_with_stdio(0); cin >> n >> k >> x; for (i = 1; i <= n; ++i) cin >> y, ++freq[y]; for (i = 1; i <= k; ++i) { memset(aux, 0, sizeof(aux)); for (y = 0, j = 0; j <= 3000; ++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. ...
#!/user/bin/env/python 3.5 # ---*--- code:utf-8 ---*--- n,k,x=map(int,input().split(' ')) a=list(map(int,input().split(' '))) b=[] i=0 while i<k: a.sort() c=list() for each in a: c.append(each) b.append(c) if i-4>=0 and b[i]==b[i-4]: break for j in range(0,n,2): a[j]=a[j]^x i=i+1 a.sort() if i==k: print...
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 cnt = 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. ...
# -*- coding: utf-8 -*- # @Author: HaonanWu # @Date: 2017-02-25 11:12:05 # @Last Modified by: HaonanWu # @Last Modified time: 2017-02-25 12:06:04 n,k,x = map(int,raw_input().split()); a = map(int,raw_input().split()); k %= 64 for i in range(k): a = sorted(a) for j in range(n): if j%2 == 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 a[100060]; int vis[10005]; int maxn[100060]; int minn[100060]; int main() { int n, k, x; while (~scanf("%d%d%d", &n, &k, &x)) { int flag = 0; for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int z = 0; z < k; z++) { sort(a, a + n); maxn[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> int32_t as[1024]; int32_t bs[1024]; int32_t n, k, x; void perform_iteration(int32_t *from, int32_t *to) { int32_t i; uint32_t flag = 1; for (i = 0; i < 1024; i++) { to[i ^ x] += (from[i] + flag) / 2; to[i] += (1 + from[i] - flag) / 2; flag ^= from[i] & 1; from[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. ...
#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 > 1000) { long long times = min(k, 1000LL); k = k %...
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, a[100010], dp[2][1030], now, cnt; int main() { scanf("%d%d%d", &n, &k, &x); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); dp[0][a[i]]++; } now = 0; for (int i = 1; i <= k; ++i) { now ^= 1; cnt = 0; memset(dp[now], 0, sizeof(dp...
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> int main() { std::ios_base::sync_with_stdio(false); unsigned x; long n, k; std::cin >> n >> k >> x; std::vector<long> cnt(1024), new_cnt(1024); for (long i = 0; i != n; ++i) { unsigned v; std::cin >> v; ++cnt[v]; } for (long i = 0; i != k; ++i) { long count = 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; long long int n, i, j, l = 0; long long int a[300000]; int main() { int k, x; int min1, max1; cin >> n >> k >> x; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (i = 0; i < min(k, k % 4 + 8); i++) { for (j = 0; j < n; j += 2) { a[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; const int MAXN = 3 * 1e3; int main() { int n, k, x; cin >> n >> k >> x; vector<int> a(MAXN, 0); for (int i = 0; i < n; i++) { int z; cin >> z; a[z]++; } for (int i = 0; i < k; i++) { vector<int> b(MAXN, 0); bool fl = 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.util.Scanner; /** * Created by DQ-PC on 22.02.2017. */ public class CFavoriteNumber { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt() % 64; int x = in.nextInt(); int[] a = new int[1025]; ...
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 = 1 << 30; const int maxn = 1090; int num[2][maxn]; int main() { int n, x, k; while (scanf("%d%d%d", &n, &k, &x) != EOF) { int buf, ma, mi; ma = -INF; mi = INF; for (int i = 0; i < n; i++) { scanf("%d", &buf); num[0][buf]++; ...
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 *dp1 = new int[1030]; int *dp2 = new int[1030]; memset(dp1, 0, 1030 * sizeof(int)); memset(dp2, 0, 1030 * sizeof(int)); int n, k, x; cin >> n >> k >> x; int buf; for (int i = 0; i < n; i++) { cin >> buf; dp1[buf]++; } 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; vector<int> a; vector<vector<int> > lst, lt; set<vector<int> > lst2; int main() { ios_base::sync_with_stdio(0), cin.tie(0); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int t; cin >> t; a.push_back(t); } sort(a.begin(), a.end()); ...
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 mod = 998244353; const long long INF = 1ll << 60; const int maxn = 3e5 + 10; const int maxl = 1 << 10; const double pi = acos(-1.0); const double eps = 1e-8; int cn[maxl], tmd[maxl]; int n, k, x; void arr() { int tot = 0; memset(tmd, 0, sizeof(tmd)); for (int 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; int n, k; int cnt[1024]; int cnt2[1024]; int x; void go() { int now = 0; for (int i = 0; i < 1024; i++) cnt2[i] = 0; for (int i = 0; i < 1024; i++) { if ((cnt[i] & 1) == 0) { cnt2[i ^ x] += cnt[i] >> 1; cnt2[i] += cnt[i] >> 1; } if ((now & 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> const long long INF = 4e18L + 1; const int IINF = 2e9 + 1; using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; c...
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.util.Scanner; public class JonSnowAndHisFavouriteNumber { public static void main(String[] args) throws IOException { 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_VAL...
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() ) A = list( map( int, input().split() ) ) freq = [ [ 0 for i in range( 1024 ) ], [ 0 for i in range( 1024 ) ] ] for i in range( N ): freq[ 0 ][ A[ i ] ] += 1 for i in range( K ): for j in range( 1024 ): freq[ ~ i & 1 ][ j ] = 0 ctr = 0 for j in range( 1024 ): if ctr...
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 + 11; const long long MOD = 1e9 + 7; int a[N], b[N], c[N]; vector<int> v; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 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. ...
f=lambda:[int(x) for x in input().split()] n,k,x=f() L=f() mi=min(L) ma=max(L) for i in range(k%128): L.sort() mi=10**3^(2*10**3) ma=0 for j in range(len(L)): if j%2==0: L[j]=L[j]^x if L[j]<mi: mi=L[j] if L[j]>ma: ma=L[j] print(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. ...
#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 > 92) { long long times = min(k, 92LL); k = k % 92;...
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[100050]; int n, k, x; int ans[105][100050]; const int INF = 0x3f3f3f3f; int main() { cin >> n >> k >> x; for (int i = 0; i < n; i++) scanf("%d", &a[i]); int i; sort(a, a + n); if (k == 0) { printf("%d %d\n", a[n - 1], a[0]); return 0; } if (k == ...
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> Guards; int main() { int n, k, x; int dummy; scanf("%d %d %d", &n, &k, &x); for (int i = 0; i < n; i++) { scanf("%d", &dummy); Guards.push_back(dummy); } sort(Guards.begin(), Guards.end()); k %= 64; for (int i = 0; i < k; i++) { 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. ...
import java.io.*; import java.util.*; /** * * @author Sourav Kumar Paul (spaul100) * NIT Silchar */ public class SolveC { public static Reader in; public static PrintWriter out; public static long mod = 1000000007; public static long inf = 100000000000000000l; public static long fac[],inv...
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> inline int read() { int x = 0, f = 0; register char ch = getchar(); for (; ch < 48 || ch > 57; ch = getchar()) f |= ch == '-'; for (; ch > 47 && ch < 58; ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return f ? ~x + 1 : x; } using namespace std; int m[1024], tmp[1024]; 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; void solve() { const int MAX = 1024; int n, k, x; cin >> n >> k >> x; vector<int> freq(MAX); for (int i = 0; i < n; i++) { int val; cin >> val; freq[val]++; } for (int j = 0; j < k; j++) { int covered = 0; vector<int> updated(MAX); 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. ...
N, K, X = map(int, input().split()) a = list(map(int, input().split())) M = 1024 dp = [0] * M for i in range(N): dp[a[i]] += 1 for k in range(K): cnt = 0 tmp = dp.copy() dp = [0] * M for i in range(M): d1, d2 = 0, 0 if tmp[i] % 2 == 0: d1, d2 = tmp[i] // 2, tmp[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. ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") const int N = 1e5 + 10, M = 1024; int a[N], cnt[N], n, k, x; int main() { scanf("%d %d %d", &n, &k, &x); int ai; for (int i = 1; i <= n; i++) { scanf("%d", &ai); a[ai]++; } for (int ca = 1; ca <= k; ca+...
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 T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")"; } int N; int sany[2][1029]; int x, k; int yary[100009]; int al[100009]; int main() { for (int i = (0); i <= (100009 - 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. ...
n, k, m = map(int, raw_input().strip().split()) y = map(int, raw_input().strip().split()) x = [0] * 1024 for v in y: x[v] += 1 for j in xrange(k): z = [0] * 1024 t = 1 for i in xrange(1024): w = (x[i]+t)/2 z[i] += x[i]-w z[i^m] += w if x[i]%2: t = 1-t 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; void input(); void solve(); int N, K, X; int dp[2][2048]; int main() { input(); solve(); return 0; } void input() { int a; scanf("%d%d%d", &N, &K, &X); for (int i = 0; i < N; i++) { scanf("%d", &a); dp[0][a]++; } } void solve() { int i, j, seen, 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. ...
n, k, x = map(int, input().split()) rangers = list(map(int, input().split())) for i in range(min(k, 8 + (k & 3))): rangers.sort() rangers = [rangers[i] if (i & 1) else rangers[i] ^ x for i in range(n)] rangers.sort() print(rangers[-1], rangers[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> #pragma warning(disable : 4786) #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-6; const int maxn = 1e5 + 5; int a[maxn], vis[2][2055]; int main() { int 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 main() { int n, k, x; cin >> n >> k >> x; int freq[1500]; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; freq[a[i]]++; } int temp[1500]; while (k--) { for (int i = 0; i < 1500; i++) { temp[i] = freq[i]; } int parity = 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. ...
n,k,x=map(int,raw_input().split()) a=list(map(int,raw_input().split())) for i in range(min(k, 8 + k%4)): a.sort() a=[a[i]if i%2 else a[i]^x for i in range(n)] a.sort() print a[-1],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.util.StringTokenizer; public class Main { private static int N, K, X; private static int[] array = new int[1024]; public static void main(String[] args) throws IOException { BufferedReader f = new BufferedRea...
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()) rangers = list(map(int, input().split())) for i in range(min(k, 8 + k%4)): rangers.sort() rangers = [ rangers[i] if i%2 else rangers[i]^x for i in range(n)] # print(rangers) rangers.sort() print(rangers[-1], rangers[0]) # Made By Mostafa_Khaled
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 woah[2][1024] = {0}; int main() { ios::sync_with_stdio(false); int n, k, x, a; cin >> n >> k >> x; for (int i = 0; i < n; ++i) { cin >> a; woah[0][a]++; } for (int i = 1; i <= k; ++i) { int count = 0; for (int j = 0; j < 1024; ++j) { wo...
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 maxx[100005]; int minn[100005]; int n, k, x, t; vector<int> a; int main() { int tt; cin >> n >> k >> x; for (int i = 0; i < n; i++) { cin >> tt; a.push_back(tt); } sort(a.begin(), a.end()); maxx[0] = a[n - 1]; minn[0] = a[0]; 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. ...
#include <bits/stdc++.h> using namespace std; const int N = (1 << 10); void solve() { int n, k, x, y; cin >> n >> k >> x; vector<int> freq(N, 0), temp(N, 0); for (int i = 0; i < n; i++) { cin >> y; freq[y]++; }; for (int i = 0; i < k; i++) { int till = 0; for (int j = 0; j < N; j++) temp[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. ...
def main(): first_line = input() second_line = input() n, k, x = map(int, first_line.split()) rangers = list(map(int, second_line.split())) xor_results = get_xor_results(x) rangers = snow(n, k, xor_results, rangers) print_max_min(rangers) def get_xor_results(x): return [i^x for i 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. ...
#include <bits/stdc++.h> using namespace std; template <class T1> T1 GCD(T1 A, T1 B) { if (B == 0) return A; else return GCD(B, A % B); } template <class T2> T2 mulmod(T2 a, T2 b) { T2 x = 0, y = a % 1000000007; while (b) { if (b % 2 == 1) { x = (x + y) % 1000000007; } y = (2 * y) % 10...
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 i, j, n, k, x, aux, ma, mi; vector<long long> v1(1030, 0), v2(1030, 0); cin >> n >> k >> x; for (i = 0; i < n; i++) { cin >> aux; v1[aux]++; } while (k--) { aux = 0; for (i = 0; i <= 1025; i++) { if (v1[i] == 0) conti...
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.InputMismatchException; import java.io.IOException; import java.io.PrintWriter; public class C_399 { public static int mod = 1000000007; static FastReader scan = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String args[]...
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> T max2(T a, T b) { return a < b ? b : a; } template <class T> T min2(T a, T b) { return a < b ? a : b; } template <class T> T max3(T a, T b, T c) { return max2(max2(a, b), c); } template <class T> T min3(T a, T b, T c) { return min2(min2(a, b), c)...
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 c[2][1024]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); int n, k, x; cin >> n >> k >> x; for (int i = 1; i <= n; i++) { int y; cin >> y; c[0][y]++; } for (int kk = 1; kk <= k; kk++)...
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.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class C399 {...
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 i64 = long long; using Pii = pair<int, int>; constexpr int MAX = 200010; constexpr int INF = 0x3F3F3F3F; int a[MAX], b[2][MAX]; Pii Solve(int n, int k, int x) { int m = 0; for (int i = 0; i < n; ++i) { m = max(m, a[i]); m = max(m, a[i] ^ x); } memset(b...
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.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comp...
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 = 2000; int cnt[N]; int a[N][2]; int main() { int n, k, x; scanf("%d %d %d", &n, &k, &x); memset(cnt, 0, sizeof cnt); for (int i = 0; i < n; ++i) { int foo; scanf("%d", &foo); ++cnt[foo]; } while (k--) { for (int i = 0, j = 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. ...
#include <bits/stdc++.h> using namespace std; const int sz = 1100; int dp[2][sz]; int main() { int n, k, x, i, j, a; cin >> n >> k >> x; for (i = 0; i < n; i++) { cin >> a; dp[0][a]++; } for (i = 0; i < k; i++) { bool r = true; for (j = 0; j < sz; j++) if (dp[0][j] != 0) { int cu...
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 = 1026; int cnt1[maxN]; int cnt2[maxN]; int main(void) { int n, k, x; ios_base::sync_with_stdio(0); cin >> n >> k >> x; for (int i = 0; i < n; i++) { int pp; cin >> pp; cnt1[pp]++; } int *p1 = cnt1; int *p2 = cnt2; for (int 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. ...
n,k,x = map(int,raw_input().split()); a = map(int,raw_input().split()); for i in range(min(k, 16+ k%16)) : a = sorted(a) for j in range(0,n) : if j%2 == 0 : a[j] ^=x 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. ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a < b) swap(a, b); if (b == 0) return a; while ((a = a % b) != 0) { swap(a, b); } return b; } long long modpow(long long x, int y) { long long res = 1; while (y > 0) { if (y & 1) res = res * x % 998244353; y = y >> 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.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public class Solution{ public static void main(String[] args) { FastS...
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.util.Arrays; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; 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. ...
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Stream; public class icpc { public static void main(String[] args) throws IOException { Reader in = new Reader(); //BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); 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; const int N = 1e5 + 5; const int M = 1 << 10; int n, k, x; int arr[N]; int cnt[M]; int tmp[M]; int main() { memset(cnt, 0, sizeof(cnt)); scanf("%d %d %d", &n, &k, &x); for (int i = 1; i <= n; ++i) { scanf("%d", arr + i); ++cnt[arr[i]]; } 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.util.Scanner; public class Test { /** * @param args */ public static void main(String[] args) { int length = 2000; int[] a = new int[length + 1]; int[] b = new int[length + 1]; Scanner scanner = new Scanner(System.in); int n, k, x; n = sc...
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 Round_399; import java.io.PrintWriter; import java.util.Scanner; public class C { public C() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int k = sc.nextInt(); int x = sc.nextInt(); int[] freq = new int[1024]; int[] tmp = new 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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.TreeMap; ...
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 s = 0, w = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar(); return s * w; } vector<int> v; signed main() { 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; const int N = 2e5 + 50; const int INF = 1e6 + 50; const double EPS = 1e-8; int a[N], b[N]; int main() { ios::sync_with_stdio(0); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int t; cin >> t; a[t]++; } for (int i = 0; i < k; 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; string s[11000]; int n, k, x, a[110000]; string str; struct node { int x, y; } p[110000]; int main() { scanf("%d%d%d", &n, &k, &x); for (int i = 0; i < n; i++) scanf("%d", &a[i]); sort(a, a + n); p[0].x = a[0], p[0].y = a[n - 1]; int indx = 0, y = -1; for (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. ...
n, k, x = map(int, input().split()) arr = list(map(int, input().split())) dp = [[0 for i in range(1024)], [0 for i in range(1024)]] for i in range(n): dp[0][arr[i]] += 1 for i in range(k): for j in range(1024): dp[~i&1][j] = 0 ctr = 0 for j in range(1024): if ctr == 0: dp[~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; long long n, l, r; vector<int> v; int a[100001]; struct P { int x, y; }; set<P> se; int main() { int n, m, k; cin >> n >> m >> k; m %= 1024; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { sort(a, a + n); for (int j = 0; j < n; 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 cf { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(Reader in) { br = new BufferedReader(in); } public FastScanner() { this(new InputStreamReader(...
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.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); Pri...
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 pr[1100]; int nx[1100]; int main() { int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; ++i) { int t; cin >> t; pr[t]++; } for (int t = 0; t < k; ++t) { int cur = 0; for (int j = 0; j < 1100; ++j) { if (pr[j] == 0) continue; ...
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.util.Arrays; import java.math.BigInteger; public class Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = sc.nextInt(); int[] count = new int[1026]; ...
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; int temp; vector<int> f(1024, 0); vector<int> t(1024, 0); for (int i = 0; i < n; i++) { cin >> temp; f[temp]++; } for (int i = 0; i < k; i++) { for (int j = 0; j < 1024; j++) t[j] = f[j]; bool 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. ...
//package round399; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), K = 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.io.*; import java.util.*; public class Main { InputReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(), k = scn.nextInt(), x = scn.nextInt(); int[] fr = new int[1 << 10]; for (int i = 0; i < n; i++) { int z = scn.nextInt(); fr[z]++; } 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. ...
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 10; int n, k, x; int a[66][maxn]; int check(int t) { for (int i = 0; i < t; ++i) { int j; for (j = 0; j < n; ++j) { if (a[i][j] != a[t][j]) break; } if (j == n) return i; } return -1; } int main() { ios::sync_with_st...
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[1 << 10], b[1 << 10]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k, x; cin >> n >> k >> x; while (n--) { int t; cin >> t; a[t]++; } while (k--) { memset(b, 0, sizeof(b)); bool ok = 1; for (int i = 0; i < (1 << 10); 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()) rangers = map(int, raw_input().split()) for i in range(min(k, 8 + k%4)): rangers = sorted(rangers) rangers = [ rangers[i] if i%2 else rangers[i]^x for i in range(n)] # parint(rangers) print max(rangers),min(rangers)
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 > 500) { long long times = min(k, 500LL); k = k % 5...
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 CyBerForCe() { long long n, k, x; cin >> n >> k >> x; vector<long long> v, u1, u2; long long f[1024] = {0}, temp[1024]; for (long long i = 0; i < n; i++) { long long a; cin >> a; v.push_back(a); f[a]++; } for (long long i = 0; i < k; 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 cnt[1024], 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, cnt[p]++; for (int i = 0; i < k; i++) { for (int j = 0; j < 1024; j++) tmp[j] = cnt[j]; int par = 0; for (int j = 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.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeMap; public class CF399C { static class Array implements Comparable<Array> { int a[]; Array(int b[]) { a = b...
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.*; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static void main(String[] args) throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), 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; const int INF = 1024; int n, k, x, buc[INF + 1], tmp[INF + 1], p, ansmin = INF, ansmax; int main() { scanf("%d%d%d", &n, &k, &x); for (int i = 1; i <= n; ++i) { int t; scanf("%d", &t); ++buc[t]; } memcpy(tmp, buc, sizeof(buc)); for (int i = 1; i <= k; ...
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; const char E = '\n'; const int N = 1005; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x, dp[2][1024] = {0}; cin >> n >> k >> x; for (int i = 1; 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()) a = map(int,raw_input().split()) k %= 64 q = len(a) for i in range(k): a.sort() for i in range(0,q,2): a[i] ^= x a.sort() print a[-1],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. ...
#include <bits/stdc++.h> using namespace std; template <typename T> void trace(T a) { cout << a << "\n"; } template <typename T, typename... Args> void trace(T a, Args... args) { cout << a << " "; trace(args...); } int recNum = 0; void prTabs() { for (int i = 0; i < recNum; i++) cout << " "; } template <type...
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.Arrays; import java.util.NoSuchElementException; import java.util.Random; import java.util.TreeMap; public class C { private void solve(FastScanner in, PrintWriter out) { TreeMap<Long, Integer> map = new TreeMap...
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 Main { public static void main(String[] args) { // Write your code here Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int k = scn.nextInt(); int x = scn.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = scn.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; void preprocess(void) { return; } int main(void) { preprocess(); int t; t = 1; for (int z = 1; z <= t; z++) { int n, k, x; scanf("%d", &n), scanf("%d", &k), scanf("%d", &x); int bit[1024]; int tbit[1024]; memset(bit, 0, sizeof bit); for (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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Scanner; import java.util.StringTokenizer; public class C { public static void main(String[] args) 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 N = 2050; int xo[N]; int q[N]; int temp[N]; int main() { int n, k, x; scanf("%d %d %d", &n, &k, &x); for (int i = 0; i < N; i++) { xo[i] = i ^ x; temp[i] = 0; q[i] = 0; } for (int i = 0; i < n; i++) { int a; scanf("%d", &a); q[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. ...
n, k, x = map(int, input().split()) rangers = list(map(int, input().split())) for i in range(min(k, 8 + k%4)): rangers.sort() rangers = [ rangers[i] if i%2 else rangers[i]^x for i in range(n)] # print(rangers) rangers.sort() print(rangers[-1], rangers[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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.concurrent.ThreadLocalRandom; import java.io.B...
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, m, s, k, num, s1, s2, a[100005], v[505][100005]; int f(int p) { int i, j; for (i = 0; i < p; i++) { for (j = 0; j < n; j++) { if (v[i][j] != a[j]) break; } if (j == n) return i; } return -1; } int main() { int i, j, t, tans; cin >> n >> ...