Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define lowbit(x) (x & -x)
using namespace std;
t... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<ll,ll>
#define ct(x) cout<<x<<' ';
#define nl cout<<'\n';
#define lb lower_bound
#define all(v) v.begin(), v.end()
#define pb push_back
ll MOD = 1e9+7;
int main(){
int tc;
cin>>tc;
while(tc--){
int n,k,m;
cin>>n>>k>>m... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import sys
input=sys.stdin.readline
t=int(input())
for you in range(t):
l=input().split()
n=int(l[0])
k=int(l[1])
m=int(l[2])
l=input().split()
li=[int(i) for i in l]
if((n-m)%(k-1)):
print("NO")
continue
poss=0
for i in range(m):
z=n-li[i]
z-=(m-i-1)
... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
for(int q=ni();q>0;q--){
work();
}
out.flush();
}
... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
using namespace std;
typedef __int128 LL;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
const int mod = 1e9+7;
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll , ll> pii;
typedef long double ld;
typedef map<pii,set<pii> >::iterator mapit;
typedef multiset<ll>::iterator setit;
const int maxn = 1e6 + 43;
const int maxm = 3003;
const ll maxii = 1e11 ;... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 2e5 + 50;
int n , k , m;
int b[maxn];
vector<int>d;
int l[maxn];
int r[maxn];
int cnt;
int flag;
set<int>s;
void init()
{
cnt = 0;
memset(l , 0 , sizeof(l));
memset(r , 0 , sizeof(r));
flag = 0;
}
int main()
{
int ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <iostream>
#include <cstring>
using namespace std;
const int N = 2e5 + 10;
int a[N], st[N];
int main()
{
int t;
cin >> t;
int n, m, k;
while(t --)
{
int success = 0;
cin >> n >> k >> m;
// cout << n << k << m <<endl;
for (int i = 1; i <= n; i ++) st[i] = 0... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace :: std;
#define ll long long
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pb push_back
const int maxn=2e5+500;
const int inf=1e9+900;
const int mod=1e9+7;
bool a[maxn];
int pr[maxn];
int saf[maxn];
int main(){... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | /*
* Author: Lanly
* Time: 2020-12-26 09:28:00
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template <typename T>
void read(T &x) {
int s = 0, c = getchar();
x = 0;
while (isspace(c)) c = getchar();
if (c == 45) s = 1, c = getchar();
while (isdigit(c)) x = (x << 3) + (x... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define R return
#define B break
#define C continue
#define sf scanf
#define pf printf
#define pb push_back
#define F first
#define S second
using namespace std;
const ll N=500500,K=22,Inf=4e18,Mx=3e5;
const ld eps=1e-10;
ll a[N];
int main()
{
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
// Prioridade
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define IN... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
int n, k, m, arr[N];
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
scanf("%d%d%d", &n, &k, &m);
for(int i = 0 ; i < m ; i+... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | for _ in range(int(input())):
n,k,m=tuple(map(int,input().split(" ")));ml=set(map(int,input().split(" ")));havitada=[i for i in range(1,n+1) if i not in ml];saab=False
if len(havitada)%(k-1)!=0:print("no");continue
for i in range(k//2-1,len(havitada)-k//2):
if havitada[i+1]-havitada[i]!=1:print("yes");break
else:... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n, k, m, a, x, y, cnt1, cnt2;
cin >> n >> k >> m;
vector<int> v;
v.push_back(0);
for (int i = 1; i <= m; i++) {
cin >> a;
v.push_b... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int T,a[N],n,m,k,mark;
int main() {
scanf("%d",&T);
while(T--){
memset(a,0,sizeof a);
scanf("%d%d%d",&n,&k,&m);
for(int i=0;i<m;++i){
int x;
scanf("%d",&x);
a[x]=1;
}
//cout << "\nn = " << n << " k = " << k << ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=3e5+5;
void solve(){
int n,k,m;
cin>>n>>k>>m;
vector<int>v,vis(n);
while(m--){
int x;
cin>>x;
vis[x-1]=1;
}
for(int i=0;i<n;i++)
if(!vis[i])
v... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
int t , k , n , m , x , totl , totr , l , r , flag;
int a[N];
int main()
{
cin >> t;
while(t --)
{
for(int i = 1 ; i <= n ; i ++)
a[i] = 0;
flag = 0;
totl = 0;
totr = 0;
cin >> n >> k ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, k;
cin >> n >> k >> m;
int x;
vector<int> a(n + 1, 0);
for (int i = 0; i < m; ++i) {
cin >> x;
a[x] = 1;
}
int c0 = n - m, c = 0;
bool can = false;
can |= c0 == 0;
for (int i = 1; i <= n; ++... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
bool good[200005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin>>T;
while(T--){
int n, k, m;
cin>>n>>k>>m;
for(int i=1;i<=n;i++){
good[i]=false;
}
for(int i=0;i<m;i++){
int x;
cin>>x;
good[x]=true;
}
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using ii = pair<int, int>;
using pii = pair<int, int>;
using vi = vector<int>;
#define sz(x) ((int)((x).size()))
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
template <typename T1, typename ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
n,k,m = map(int,stdin.readline().split())
b = list(map(int,stdin.readline().split()))
if (n-m)%(k-1) != 0:
print ("NO")
continue
lis = [1] * n
for i in b:
lis[i-1] = 0
ns = 0
while ns != k//... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<cstdio>
#include<vector>
using namespace std;
int T,N,K,M;
bool ex[2<<17];
int main()
{
scanf("%d",&T);
for(;T--;)
{
scanf("%d%d%d",&N,&K,&M);
for(int i=0;i<N;i++)ex[i]=false;
for(int i=0;i<M;i++)
{
int b;scanf("%d",&b);ex[b-1]=true;
}
if((N-M)%(K-1)!=0)
{
puts("NO");
continue;
}
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | //November
#include<cstring>
#include<iostream>
using namespace std;
const int maxn=5e5+1;
int a[maxn];
bool visit[maxn];
int main()
{
int T;
cin>>T;
while(T--)
{
int n,k,m;
cin>>n>>k>>m;
for(int i=1;i<=m;i++)
cin>>a[i];
memset(visit,0,sizeof(visit));
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
cin.tie(nullptr);
cout.tie(nullptr);
ios_base::sync_with_stdio(false);
cout.setf(ios::fixed); cout.precision(20);
// freopen("input.txt",... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | // Retired?
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long unsigned long ull;
typedef double long ld;
int main() {
ios::sync_with_stdio(!cin.tie(0));
int t;
cin >> t;
while (t--) {
int n, k, m;
cin >> n >> k >> m;
k--;
vector<int> u(n);
for (int i=0; i<m;... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
const int N = 2e5 + 9;
using namespace std;
int n,k,m,x;
int a[N];
int main() {
int T;
cin >> T;
while (T--) {
cin >> n >> k>>m;
for (int i=1;i<=n;i++)
a[i]=0;
for (int i=0;i<m;i++)
{
scanf("%d",&x);
a[x]++;
}
if ((n-m)%(k-1)!=0)
{
cout<<"No"<<endl;
continue;
}... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#ifdef Adrian
#include "debug.h"
#else
#define debug(...) 9999
#endif
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second
#define ii pair<int,int>
template<typename G1, typename G2 = G1... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import sys
def load_sys():
return sys.stdin.readlines()
def load_local():
with open('input.txt','r') as f:
input = f.readlines()
return input
def km(n,k,m,B):
if (n-m)%(k-1) != 0:
return 'NO'
R = [0]*m
L = [0]*m
for i in range(m):
R[i] = n-B[i]-(m-i-1)
L... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | /// You just can't beat the person who never gives up
/// ICPC next year
#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;
int t ,n ,k ,m ,s[N] ,l[N] ,r[N] ;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&k,&m);
for(int i=1;i<=m;++i){
scanf("%d",s+i);... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 16 12:33:14 2021
@author: ludoj
"""
t=int(input())
res=[]
for x1 in range(t):
n,k,m=[int(i) for i in input().split()]
eind=[int(i) for i in input().split()]
x2=len(eind)
if (n-m)%(k-1)!=0:
res.append("NO")
else:
h=(k-1)//2
i1=0... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
#define int long long
#define zmrl(x) signed((x).size())
#define ahen(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii = pair<int,int>;
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
in... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | from __future__ import division, print_function
from itertools import permutations
import threading,bisect,math,heapq,sys
from collections import deque
# threading.stack_size(2**27)
# sys.setrecursionlimit(10**4)
from sys import stdin, stdout
i_m=9223372036854775807
def cin():
return map(int,sin().split())
def... | PYTHON |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie(0)
int main() {
IO; //freopen("in.txt", "r", stdin);
int T; cin >> T; while(T--) {
int n, k, m; cin >> n >> k >> m;
vector<int> a(m);
for(int i = 0; i < m; ++i) {
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(0);
int t;
cin >> t;
while(t--){
int n,k,m;
cin >> n >> k >> m;
vector<int> b(m,0);
for(auto &it:b) cin >> it;
for(auto &it:b) it--;
if(m==n){
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll t; cin >> t;
while (t--)
{
ll n, m, k; cin >> n >> k >> m;
vector<... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define endl '\n'
#define lli long long int
#define ld long double
#define forn(i,n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define SZ(s) int(s.size())
using namespace std;
typedef vector<lli> V... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define debug2(a, b) cerr<<#a<<"="<<(a)<<" ";debug(b)
#define debug3(a, b, c) cerr<<#a<<"="<<(a)<<" ";... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import heapq
t = int(input())
for _ in range(t):
n, k, m = map(int, input().split())
l = [0] + list(map(int, input().split())) + [n+1]
diffs = [l[i+1]-l[i]-1 for i in range(m+1)]
if sum(diffs) % (k-1) > 0:
print('NO')
continue
ls = 0
ind = -1
while ls < k//2:
ind +=... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | //#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#define ll long long
#define MOD 998244353
#... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<iostream>
using namespace std;
int x[200001];
int t,n,k,m;
int l,r,last,d,mk;
void solve(){
cin>>n>>k>>m;
l=0;
r=n-m;
last=0;
d=0;
mk=k/2;
for(auto i=x;i!=x+m;i++){
cin>>*i;
}
if((n-m) % (k-1) != 0){
cout<<"no\n";
return;
}
for(int i=0;r>=mk && i<m;i++){
d = x[i] - last - 1;
l += d;
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | // In the name of god
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x));
#define debug(x) cerr << #x << " : " << x << "\n"
#define use_file freopen("input.txt", "r", stdin); frepen("output.txt", "w", stdout);
using namespace s... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | /**
* Author: Daniel
* Created Time: 2021-01-28 17:54:32
**/
// time-limit: 2000
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ER erase
#define IS insert
#define PI acos(-1)
#define PB pop_back
#define EB emplace_back
#define lowbit(x) (x & -x)
#define SZ(x) ((int)x.size()... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | """
Author - Satwik Tiwari .
15th Dec , 2020 - Tuesday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import Byte... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | T=int(input())
for _ in range(T):
n,k,m=map(int, input().split())
b=[0]+list(map(int, input().split()))+[0]*10 #1~m (len=m+1)
cnt=0
l=[0]*(m+10)
r=[0]*(m+10)
for i in range(1,m+1): #i:1~m
cnt+=b[i]-b[i-1]-1
l[i]=l[i-1]+b[i]-b[i-1]-1
cnt+=n-b[m]
r[m]=n-b[m]
for i i... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | //#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<iomanip>
#include<queue>
#include<cmath>
#include<stack>
#include<map>
#define ll long long
#define skip cin>>ws;
#define vll vector<ll>
#define vi ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k, m, b[N];
void solve()
{
scanf("%d%d%d", &n, &k, &m);
for(int i=1; i<=m; i++) scanf("%d", b+i);
if((n-m)%(k-1)) puts("NO");
else
{
for(int i=1; i<=m; )
{
int j = i + 1;
while(j<=m && b[j]==b[i]+1) ++j;
if((b[j-1]-j+1)>=k/2 &... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define int long long
#define PI pair<int,int>
using namespace std;
const int maxm=2e6+5;
int b[maxm];
int n,k,m;
void solve(){
cin>>n>>k>>m;
for(int i=1;i<=m;i++){
cin>>b[i];
}
if((n-m)%(k-1)){
cout<<"NO"<<endl;
return ;
}
for(int i=1;i<=m;i++){
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from itertools import accumulate
from functools import reduce,cmp_to_key,lru_cache
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
# in... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <iostream>
#include <vector>
#define int long long
signed main() {
int t;
std::cin >> t;
while(t--) {
int n, k, m;
std::cin >> n >> k >> m;
int c = (k-1)/2;
std::vector<int> stay(n, 0);
for(int i = 0; i < m; i++) {
int x;
std::cin >> x;
x--;
stay[x] = 1;
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #define _USE_MATH_DEFINES
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <math.h>
#include <ctime>
#include <cctype>
#include <vector>
#include <string>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#inclu... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | // Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
// Please name your class Main
public class Main {
static Scanner in = new Scanner(System.in);
public static void main (String[] args) throws java.lang.Exception {
PrintWriter out ... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> v... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 5;
int n, k, m;
signed main() {
int T;
cin >> T;
while (T--) {
cin >> n >> k >> m;
bool flag = false;
for (int i = 1, b; i <= m; ++i) {
cin >> b;
if (b - i >= k / 2 && n - b - (m - i) >= k / ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include "bits/stdc++.h"
using namespace std;
typedef long double ld;
typedef long long ll;
#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define f first
#define s second
template<typename T, typename U> bool ckmin(T &a, const U &b){ return b < a ? a = b, true : fal... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.util.*;
import java.util.Map.Entry;
import javax.xml.transform.OutputKeys;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
InputReader in = new InputReader(System.in);
// Scanner in = new Scanner(System.in);
// Scanner... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | for _ in range(int(input())):
n,k,m=tuple(map(int,input().split(" ")))
ml=set(map(int,input().split(" ")))
havitada=[]
for i in range(1,n+1):
if i not in ml:
havitada.append(i)
saab=False
if len(havitada)%(k-1)!=0:
print("no")
continue
for i in range(k//2-1,len(havitada)-k//2):
if havitada[i+1]-havita... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | for _ in range(int(input())):
n, k, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
remain = [0] * (n+1)
for x in arr:
remain[x] = 1
use = n - m
if use % (k-1) != 0:
print('NO')
else:
flg = False
cnt = 0
for x in ra... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long N,M,K,X,ok,cur,mark[300000];
int main()
{
int tc;
cin>>tc;
while(tc--)
{
ok=0;
cur=0;
cin>>N>>K>>M;
for(int A=1;A<=N;A++)
mark[A]=1;
for(int A=1;A<=M;A++)
{
cin>>X;
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int t;
cin >> t;
while(t--){
int n, k, m;
cin >> n >> k >> m;
int a[m];
set<int> aa;
for(int i = 0; i < m; i++) cin >> a[i], aa.insert(a[i]);
if((n - m... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
#ifdef ALBE_PC
#include"debugger.h"
#else
#define db(...) false;
#define dbg(...) false;
#define dbl(...) false;
#endif //ALBE_PC
#define endl '\n'
#define int long long
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//f... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
ll n,k,m;
cin>>n>>k>>m;
map<ll,ll>mp;
for(int i=0;i<m;i++){
ll x;
cin>>x;
mp[x]=1;
}
if((n-m)%(k-1)){
cout<<"NO"<<endl;
return;
}
ll cnt=0;
ll have=k/2;
ll xd=0,flag=0;
for(int i=1;i<=n;i++){
if(mp[i]!=1)cnt++;
e... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
int vis[200005],b[200005],r[200005];
int n,k,m;
bool check(){
if((n-m)%(k-1)!=0)return false;
for(int i=1;i<=m;i++)if(vis[b[i]]>=k/2 && vis[n]-vis[b[i]]>=k/2)return true;
return false;
}
int main(){
int t;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&k,&m);
for(i... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | /*
Washief Hossain Mugdho
04 March 2021
1468 1468H
*/
#ifndef DEBUG
#pragma GCC optimize("O2")
#endif
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define rep(i, n) for (int i = 0;... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
template<typename T>void ckmn(T&a,T b){a=min(a,b);}
template<typename T>void ckmx(T&a,T b)... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define endl '\n'
#define LL long long
#define LD long double
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const MAXN = 2e6 + 9;
int a[MAXN];
int... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define mk make_pair
const int inf = 0x3f3f3f3f;
const ll mod = 1000000007;
const ll linf = 0x3f3f3f3f3f3f3f3f;
#define deb(k) cerr << #k << ": " <<... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define prec fixed<<setprecision(9)
using namespace std;
int main()
{
fastIO
//lulz
int t; cin >> t;
while (t--) {
int n,k,m;
cin>>n>>k>>... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import sys
for _ in range(int(input())):
n,k,m=tuple(map(int,input().split(" ")))
ml=set(map(int,input().split(" ")))
havitada=[]
for i in range(1,n+1):
if i not in ml:
havitada.append(i)
saab=False
if len(havitada)%(k-1)!=0:
print("no")
continue
for i in range(k//2-1,len(havitada)-k//2):
if havitada[... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int b[200100];
int l[200100], r[200100];
int main(){
int T; scanf("%d", &T);
int tot = T;
int num = 0;
while (T--){
num++;
int N, K, M; scanf("%d%d%d", &N, &K, &M);
for (int i = 1; i <= M; i++) scanf("%d", &b[i]);
int ind =... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for(int i=(a); i<(n); ++i)
#define per(i, a, n) for(int i=(a); i>(n); --i)
#define pb emplace_back
#define mp make_pair
#define clr(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x & -x)
#define fi first
#define se... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int t,n,m,k;
bool d[200500];
int main() {
cin>>t;
while (t--) {
cin>>n>>k>>m; k=(k-1)/2;
for (int i=1; i<=n; ++i) d[i]=1;
for (int i=0; i<m; ++i) {
int t; scanf("%d",&t);
d[t]=0;
}
if ((n-m)%(2*k)) {
cout<<"NO\n"; continue;
}
for (int i=1,t=0; i<=n... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
using namespace std;
typede... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<bits/stdc++.h>
using namespace std;
namespace Sakurajima_Mai{
#define ms(a) memset(a,0,sizeof(a))
#define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
#define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
#define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
int T;
std::cin>>T;
for(; T; -- T) {
int N, K, M;
std::cin >> N >> K >> M;
std::vector<bool> is(N + 1, false);
for (int i = 1; i <= M; ++ i) {
int x;
std::cin >> x;
is[x] = true;
}
if (N == M) {
std::cout << "YES" << '\... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
double pi = acos(-1);
#define tezi ios_base::sync_with_stdio(false);\
cin.tie(0);\
cout.tie(0);
#define FOR(i... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
/*<DEBUG>*/
#define tem template <typename
#define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i)
#define _op debug& operator<<
tem C > auto test(C *x) -> decltype(cerr << *x, 0LL);
tem C > char test(...);
tem C > struct itr{C b... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
def __init__(self, file):
self.newlines = 0
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buf... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, k, m, b[N];
int main() {
int t;
scanf("%d", &t);
while (t){
t--;
scanf("%d%d%d", &n, &k, &m);
for (int i=0; i<m; i++) scanf("%d", b+i);
if ((n-m)%(k-1)) printf("NO\n");
else {
bool ok = 0;
for (int i=0; i<m; i++... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static int n;
static ArrayList<int[]>[] ad, ad2;
static long[][] memo;
static boolean vis[];
static long[] f, inv, ncr[];
static HashMap<I... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | from sys import stdin, stdout
# if erased left elements >= (k-1)/2
# and erased right elements >= (k-1)/2
# and (n-m)%(k-1) == 0
# then YES
# Prove:
# set d = (k-1)/2
# left elements: d + x
# right elements: d + y
# ------------------------------------------
# if x + y >= k, set x + y = x + y - n*(k-1)
# then x +... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sparsh Sanchorawala
*/
pub... | JAVA |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define x1 x1228
#define y1 y1228
#define left left228
#define right right228
#define pb push_back
#define eb emplace_back
#define mp make_pair
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import sys
input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)
def multiLineArrayPrint(arr):
print('\n'.join([str(x) for x in arr]))
allAns=[]
t=int(input())
for _ in range(t):
n,k,m=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
b.append(n+1)
... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #ifdef Prateek
#include "Prateek.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define int ll
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define dl double long
using namespace std;
const int N = 5e5 + 7;
const long long mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve()
{
int n,k,m;
cin >> n >> k >> m;
vector < ... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include<cstdio>
#include<algorithm>
using namespace std;
int b[200005];
void slove(){
int n,k,m;
scanf("%d%d%d",&n,&k,&m);
for(int i=1;i<=m;i++){
scanf("%d",&b[i]);
}
if((n-m)%(k-1)!=0){
printf("NO\n");
return ;
}else{
for(int i=1;i<=m;i++){
if(b[i]-i>=k/2&&n-b[i]-m+i>=k/2){
printf("YES\n");
... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int a[200010];
int main()
{
ios::sync_with_stdio(false);
int T;
cin>>T;
while(T--)
{
int n,k,m;
cin>>n>>k>>m;
for(int i=1;i<=n;i++) a[i]=1;
for(int x,i=1;i<=m;i++) cin>>x,a[x]=0;
if((n-m)%(k-1)!=0)
{
cout<<"NO"<<endl;
continue;
}
int cn... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | from sys import stdin
t = int(stdin.readline())
for _ in range(t):
L = [int(x) for x in stdin.readline().split(" ")]
n, k, m = L[0], L[1], L[2]
A = [int(x) for x in stdin.readline().split(" ")]
if (n - m) % (k - 1) != 0:
print("NO")
continue
works = False
k = (k - 1) // 2
... | PYTHON3 |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | #define f first
#define s second
#define loop(a,b) for(int i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ll long long
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#d... | CPP |
1468_H. K and Medians | Let's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \underline{3}, 5, 7, 12], and the median is equal to 3.
You have a sequence of n integers [1, 2, ..., n] an... | 2 | 14 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.nio.CharBuffer;
import java.io.IOException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.ByteBuffer;
import java.io.... | JAVA |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 | #include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define lb printf("\n");
#define INF 1000000000000000000
#define LES -1000000000000000000
using namespace std;
//---------------All Solution Functions Start Here--------------/... | CPP |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 | import sys,functools,collections,bisect,math,heapq
input = sys.stdin.readline
#print = sys.stdout.write
mirror = {0:0,1:1,2:5,5:2,8:8}
@functools.lru_cache(None)
def fun(i):
ones = i%10
i //= 10
tens = i%10
if ones in mirror:
newten = mirror[ones]
else:
return None
if tens in m... | PYTHON3 |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 |
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class Round705 {
static boolean check(int h,int min,int ch,int cm,HashMap<Integer, Integer>map) {
String hr=ch+"";
String mn=cm+"";
if(hr.length()==1) {
hr="0"+hr;
}
if(mn.length()==1) {
mn="0"+mn;
}
StringBuf... | JAVA |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 |
import java.util.HashMap;
import java.util.Scanner;
public class B {
static HashMap<Character, Character> mirrorMap;
static {
mirrorMap = new HashMap<>();
mirrorMap.put('0', '0');
mirrorMap.put('1', '1');
mirrorMap.put('2', '5');
mirrorMap.put('5', '2');
mirror... | JAVA |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 | #include <bits/stdc++.h>
#define MAX_N 300001
#define MAX_M 10001
#define MAX_C 10001
#define MAX 500
#define pii pair<int, int>
#define pdi pair<double, int>
#define pid pair<int, double>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define INF 987654321
#define vi vector<int>
#define sq(x) ((x) * (x))
#define ... | CPP |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(i=k;i<n;i++)
#define repr(i,k,n) for(i=k;i>=n;i--)
#define inf(i,s) for(i=s;;i++)
#define ll long long
#define pb(i) push_back(i)
#define pop pop_back();
#define all(s) s.begin(),s.end()
#define maxl 92... | CPP |
1493_B. Planet Lapituletti | The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) follows t... | 2 | 8 | #pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3", "omit-frame-pointer","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
* I've read the pro... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.