# Codeforces Round #408 (Div. 2)

/Tag: Codeforces Round #408 (Div. 2)

## Codeforces Round #408 (Div. 2), problem: (F) Sequence Recovery Solution in C/C++

By |2017-04-11T10:29:43+06:00April 11th, 2017|Categories: C/C++, Programming||

#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5, inf = 1e9 + 7; int ma[N << 2], lz[N << 2], ma2[N << 2], n; int vma[N]; void build1(int id = 1, int l = 0, int r = n) { [...]

## Codeforces Round #408 (Div. 2), problem: (E) Exam Cheating Solution in C/C++

By |2017-04-11T10:24:05+06:00April 11th, 2017|Categories: C/C++, Programming||

#include <stdio.h> #include <string.h> #include <stdbool.h> #include <assert.h> #define clr(ar) memset(ar, 0, sizeof(ar)) #define read() freopen("lol.txt", "r", stdin) short dp[2][1052][1052]; int n, p, k, A[10010], B[10010], C[10010]; int solve(int lim){ int i, j, p, x, u, v, a, b, res; clr(dp); for (p = [...]

## Codeforces Round #408 (Div. 2), problem: (D) Police Stations Solution in C

By |2017-04-11T10:21:09+06:00April 11th, 2017|Categories: C/C++, Programming||

#include <iostream> #include <string> #include <vector> #include <map> #include <queue> #include <algorithm> #include <numeric> #include <climits> using namespace std; int main(int argc, char **argv) { ios_base::sync_with_stdio(false); cin.tie(0); int N, K, D; cin >> N >> K >> D; vector<int> P(N, N); vector<vector<int>> E(N); map<pair<int, [...]

## Codeforces Round #408 (Div. 2), problem: (C) Bank Hacking Solution in C

By |2017-04-11T10:16:32+06:00April 11th, 2017|Categories: C/C++, Programming||

#include <limits.h> #include <stdio.h> #include <stdlib.h> #define N 300000 struct E { int i, j, a; } ee[N * 2]; int aa[N], ii[N]; int compare1(const void *a, const void *b) { int *ia = (int *) a; int *ib = (int *) b; int [...]

## Codeforces Round #408 (Div. 2), problem: (B) Find The Bone Solution in C

By |2017-04-11T10:11:58+06:00April 11th, 2017|Categories: C/C++, Programming||

#include <stdio.h> #define N 1000000 int main() { static int hole[N]; int n, m, k, i, j; scanf("%d%d%d", &n, &m, &k); for (j = 0; j < m; j++) { scanf("%d", &i); i--; hole[i] = 1; } i = 0; while (k-- > 0) [...]

## Codeforces Round #408 (Div. 2), problem: (A) Buying A House Solution in C

By |2017-04-11T10:08:40+06:00April 11th, 2017|Categories: C/C++, Programming||

#include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 1000000009 int main() { int i,n,m,k,min=MAX,t,temp; scanf("%d %d %d",&n,&m,&k); for(i=1;i<=n;i++) { scanf("%d",&t); if(t>0 && t<=k) { temp=abs(m-i); if(temp<min) min=temp; } } printf("%d\n",(min*10)); return 0; }