当前位置:网站首页>"Weilai Cup" 2022 Niuke summer multi school training camp 2 g.[link with monotonic subsequence] block structure
"Weilai Cup" 2022 Niuke summer multi school training camp 2 g.[link with monotonic subsequence] block structure
2022-07-26 01:30:00 【HeartFireY】
G. Link with Monotonic Subsequence structure
Topic analysis
It is required to construct a length of n n n Sequence , Make the sequence max ( lis ( p ) , lds ( p ) ) \max(\text{lis}(p), \text{lds}(p)) max(lis(p),lds(p)) As small as possible .
Dilworth theorem : Pair poset < A , ≤ > <A,≤> <A,≤>, set up A The length of the longest chain in is n n n, Will A A A The elements in are divided into disjoint inverse chains , The number of anti chains is at least n n n.
So there are lds ( p ) = c n t ( lis(p) ) \text{lds}(p) = cnt(\text{lis(p)}) lds(p)=cnt(lis(p)), So clearly max ( lis ( p ) , lds ( p ) ) ≥ max ( k , k n ) ≥ n \max(\text{lis}(p), \text{lds}(p)) \geq \max(k, \frac{k}{n}) \geq \sqrt{n} max(lis(p),lds(p))≥max(k,nk)≥n . Therefore, direct construction n \sqrt{n} n Just one block .
Code
#include <bits/stdc++.h>
#pragma gcc optimize(2)
#define int long long
#define endl '\n'
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7;
inline void solve(){
int n = 0; cin >> n;
int b = ceil(sqrt(n));
while(n > 0){
for(int i = max(1ll, n - b + 1); i <= n; i++) cout << i << " ";
n -= b;
}
cout << endl;
}
signed main(){
ios_base::sync_with_stdio(false), cin.tie(0);
int t = 1; cin >> t;
while(t--) solve();
return 0;
}
边栏推荐
- QTreeWidget虚线设置
- ABC find 4-cycle (pigeon nest theorem)
- Browser development and use skills
- 01. MySQL transaction isolation level and concurrent database access
- Machine learning: Bayesian Networks
- The best way to practice Animation: cover transition
- Easyrecovery15 data recovery software with high recovery rate and high download volume
- zeromq浅析
- Tutorial on the principle and application of database system (057) -- MySQL exercises
- Mapbox GL JS active map refresh method
猜你喜欢

NodeJS 基于 Dapr 构建云原生微服务应用,从 0 到 1 快速上手指南

Iftnews | suppose this is what the metauniverse looks like 20 years later

网络文件传输之零拷贝

API测试简介

Two stage submission and three stage submission
![[ickim 2022] the Fourth International Conference on knowledge and information management](/img/e0/1d7aebc6a6fe42c4f4ddd47a2045ec.jpg)
[ickim 2022] the Fourth International Conference on knowledge and information management

Codisvsrediscluster: which cluster scheme should I choose?

机器学习:贝叶斯网络

2022年最新北京建筑八大员(材料员)模拟考试试题及答案

What is informatization? What is digitalization? What are the connections and differences between the two?
随机推荐
Kubernetes pod start process
[go] how to control the maximum number of concurrent processes
Easyrecovery15 data recovery software with high recovery rate and high download volume
销量连连夺冠,五菱的成功秘诀只有低价吗?
Working principle of ZK rollups
[secsha concept] original reverse supplement
[ickim 2022] the Fourth International Conference on knowledge and information management
Zombie‘s Treasure Chest(枚举)
如何获取广告服务流量变现数据,助力广告效果分析?
Leetcode537. Complex multiplication (yes, solved)
Zero copy of network file transfer
01. MySQL transaction isolation level and concurrent database access
poj1521
Advanced C language (I) dynamic memory allocation
U++ learning notes ustruct, uenum declaration and function library simple function implementation
电视机软件烧录
Prime Ring Problem
[combinational logic circuit] - encoder
PTGui Pro12垂直线纠正
Detailed explanation of at and crontab commands of RHCE and deployment of Chrony