The Preliminary Contest for ICPC Asia Nanjing 2019

LLM推理服务中的SLO感知调度优化实践 在AI服务架构中,服务级别目标(SLO)是衡量服务质量的核心指标,特别是在大型语言模型(LLM)推理场景下。SLO通常涉及TTFT(首token时间)、TPOT(每token生成时间)和端到端延迟等关键维度,这些指标直接影响用户体验和系统效率。传统FCFS调度策略由于缺乏SLO感知能力,在混合负载下往往导致资源利用率低下和SLO达标率骤降。通过引入基于模拟退火的动态调度算法和精准的延迟预测模型,可以实现对不同优先级请求的智能调度,显著提升GPU利用率和SLO达标率。这种技术方案特别适用于需要同时处理实时对话 阅读详情

F - Greedy Sequence

You’re given a permutation aa of length n ( 1 ≤ n ≤ 1 0 5 ) . n (1 \le n \le 10^5 ). n(1≤n≤105).

For each i ∈ [ 1 , n ] i \in [1,n] i∈[1,n], construct a sequence s i s_i si​ by the following rules:

  1. s i [ 1 ] = i s_i[1]=i si​[1]=i;
  2. The length of s i s_i si​ is n n n, and for each j ∈ [ 2 , n ] j \in [2, n] j∈[2,n], s i [ j ] ≤ s i [ j − 1 ] s_i[j] \le s_i[j-1] si​[j]≤si​[j−1];
  3. First, we must choose all the possible elements of s i s_i si​ from permutation aa. If the index of s i [ j ] s_i[j] si​[j] in permutation a a a is p o s [ j ] pos[j] pos[j], for each j ≥ 2 j \ge 2 j≥2, ∣ p o s [ j ] − p o s [ j − 1 ] ∣ ≤ k ( 1 ≤ k ≤ 1 0 5 |pos[j]-pos[j-1]|\le k (1 \le k \le 10^5 ∣pos[j]−pos[j−1]∣≤k(1≤k≤105). And for each s i s_i si​ , every element of s i s_i si​ must occur in a at most once.
  4. After we choose all possible elements for s i s_i si​, if the length of s i s_i si​ is smaller than n n n, the value of every undetermined element of s i s_i si​ is 0 0 0;
  5. For each s i s_i si​ , we must make its weight high enough.

Consider two sequences C = [ c 1 , c 2 , . . . c n ] C = [c_1, c_2, ... c_n] C=[c1​,c2​,...cn​] and D = [ d 1 , d 2 , . . . , d n ] D=[d_1, d_2, ..., d_n] D=[d1​,d2​,...,dn​], we say the weight of C C C is higher than that of D D D if and only if there exists an integer k k k such that 1 ≤ k ≤ n , c i = d i 1 \le k \le n, c_i=d_i 1≤k≤n,ci​=di​ for all 1 ≤ i &lt; k 1 \le i &lt; k 1≤i<k and c k &gt; d k c_k &gt; d_k ck​>dk​.

If for each i ∈ [ 1 , n ] i \in [1,n] i∈[1,n], c i = d i c_i=d_i ci​=di​ , the weight of C C C is equal to the weight of D D D.

For each i ∈ [ 1 , n ] i \in [1,n] i∈[1,n], print the number of non-zero elements of s i s_i si​ separated by a space.

It’s guaranteed that there is only one possible answer.

Input
There are multiple test cases.

The first line contains one integer T ( 1 ≤ T ≤ 20 ) T(1 \le T \le 20) T(1≤T≤20), denoting the number of test cases.

Each test case contains two lines, the first line contains two integers nn and k ( 1 ≤ n , k ≤ 1 0 5 ) k (1 \le n,k \le 10^5) k(1≤n,k≤105), the second line contains nn distinct integers a 1 , a 2 , . . . , a n ( 1 ≤ a i ≤ n ) a_1, a_2, ..., a_n (1 \le a_i \le n) a1​,a2​,...,an​(1≤ai​≤n) separated by a space, which is the permutation a a a.

Output
For each test case, print one line consists of nn integers ∣ s 1 ∣ , ∣ s 2 ∣ , . . . , ∣ s n ∣ |s_1|, |s_2|, ..., |s_n| ∣s1​∣,∣s2​∣,...,∣sn​∣ separated by a space.

∣ s i ∣ |s_i| ∣si​∣ is the number of non-zero elements of sequence s i s_i si​.

There is no space at the end of the line.

样例输入

2
3 1
3 2 1
7 2
3 1 4 6 2 5 7

样例输出

1 2 3
1 1 2 3 2 3 3

有的人用的是主席树,我看好多暴力都过了,我也暴力

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+7;
int s[MAXN];
int pos[MAXN];
int main() {
        // freopen("../in.txt","r",stdin);
        // freopen("../out.txt","w",stdout);
        int t,n,x,k;
        scanf("%d",&t);
        while(t--) {
                scanf("%d %d",&n,&k);
                for(int i=0;i<n;++i) {
                        cin>>x;
                        pos[x] = i;
                }
                for(int i=1;i<=n;++i)   s[i] = 1;
                for(int i=1;i<=n;++i)
                        for(int j=i-1;j>0;--j)
                                if(abs(pos[i]-pos[j])<=k) {
                                        s[i] += s[j];
                                        break;
                                }
                for(int i=1;i<=n;++i)
                        printf("%d%c",s[i],i==n?'\n':' ');

        }
        return 0;
}

H - Holy Grail

As the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of sixty years.However,fortunately,you summoned a Caster Servant with a powerful Noble Phantasm.When your servant launch her Noble Phantasm,it will construct a magic field,which is actually a directed graph consisting of n vertices and m edges.More specifically,the graph satisfies the following restrictions :

  • Does not have multiple edges(for each pair of vertices x and y, there is at most one edge between this pair of vertices in the graph) and does not have self-loops(edges connecting the vertex with itself).
  • May have negative-weighted edges.
  • Does not have a negative-weighted loop.
  • n<=300 , m<=500.

Currently,as your servant’s Master,as long as you add extra 6 edges to the graph,you will beat the other 6 masters to win the Holy Grail.

However,you are subject to the following restrictions when you add the edges to the graph:

  • Each time you add an edge whose cost is c,it will cost you c units of Magic Value.Therefore,you need to add an edge which has the lowest weight(it’s probably that you need to add an edge which has a negative weight).
  • Each time you add an edge to the graph,the graph must not have negative loops,otherwise you will be engulfed by the Holy Grail you summon.

Input
Input data contains multiple test cases. The first line of input contains integer t — the number of testcases ( 1 ≤ t ≤ 5 ) (1 \le t \le 5) (1≤t≤5).

For each test case,the first line contains two integers n,m,the number of vertices in the graph, the initial number of edges in the graph.

Then m lines follow, each line contains three integers x, y and w ( 0 ≤ x , y ≤ n , − 1 0 9 ≤ w ≤ 1 0 9 , x ! = y ) (0 \le x,y\le n, -10^9≤w≤10^9, x != y) (0≤x,y≤n,−109≤w≤109,x!=y) denoting an edge from vertices x to y (0-indexed) of weight w.

Then 6 lines follow, each line contains two integers s,t denoting the starting vertex and the ending vertex of the edge you need to add to the graph.

It is guaranteed that there is not an edge starting from s to t before you add any edges and there must exists such an edge which has the lowest weight and satisfies the above restrictions, meaning the solution absolutely exists for each query.

Output
For each test case,output 6 lines.

Each line contains the weight of the edge you add to the graph.

样例输入
1
10 15
4 7 10
7 6 3
5 3 3
1 4 11
0 6 20
9 8 25
3 0 9
1 2 15
9 0 27
5 2 0
7 3 -5
1 7 21
5 0 1
9 3 16
1 8 4
4 1
0 3
6 9
2 1
8 7
0 4
样例输出
-11
-9
-45
-15
17
7

因为有负权,要用SPFA

6次SPFA
每次找到t到s的最短路之后,在图中加一条s到t的负边


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e3+7;
const int INF = 0x3f3f3f3f;
struct node{
        int v,w;
        node(){}
        node(int _v,int _w):v(_v), w(_w){}
};

vector<node> G[MAXN];
int n,m,dis[MAXN];
bool vis[MAXN];
// int cont[MAXN];
int SPFA(int s,int t) {
        memset(dis,0x3f,sizeof(dis));
        memset(vis,0,sizeof(vis));
        // memset(cont,0,sizeof(cont));
        queue<int> Q;
        Q.push(s);
        dis[s] = 0;
        // ++cont[s];
        while(!Q.empty()) {
                int u = Q.front(); Q.pop();
                vis[u] = false;
                for(int i=0;i<(int)G[u].size();++i) {

                        int v = G[u][i].v;
                        int w = G[u][i].w;
                        // cout<<u<<" "<<v<<" "<<w<<endl;
                        if(dis[v]>dis[u]+w) {
                                dis[v] = dis[u] + w;
                                if(!vis[v]) {
                                        Q.push(v);
                                        vis[v] = true;
                                }
				// if(++cont[v] > n)//有负环
				// 	return -1;

                        }
                }
        }
        return dis[t];
}

int main() {
        // freopen("../in.txt","r",stdin);
        // freopen("../out.txt","w",stdout);
        int t;
        scanf("%d",&t);
        while(t--) {
                node e;
                scanf("%d %d",&n,&m);
                for(int i=0;i<=n;++i)   G[i].clear();
                for(int i=0;i<m;++i) {
                        int x,y,z;
                        scanf("%d %d %d",&x,&y,&z);
                        e.v = y;
                        e.w = z;
                        G[x].push_back(e);
                }
                for(int i=0;i<6;++i) {
                        int s,t;
                        scanf("%d %d",&s,&t);
                        int ans = -SPFA(t,s);
                        printf("%d\n",ans);
                        e.v = t;
                        e.w = ans;
                        G[s].push_back(e);
                }
        }
        return 0;
}

Kerberos基础及KDC服务(理论知识) kerberos基础理论讲解+KDC服务 阅读详情

相关推荐

谐振电路原理与应用场景全解析

本文全面解析了谐振电路的原理、类型及其核心应用。详细阐述了串联谐振与并联谐振的工作特性,并重点介绍了其在无线通信调谐、音频处理分频以及电力系统滤波与无功补偿等关键场景中的实际作用。通过公式推导与实例分析,帮助读者深入理解LC谐振的选频与能量交换机制。

t1u2v的博客 840

The Preliminary Contest for ICPC Asia Nanjing 2019 题解

The Preliminary Contest for ICPC Asia Nanjing 2019 【A. The beautiful values of the palace】 【题目大意】 有一个n * n的矩阵,n为奇数,矩阵中的数字为n * n的正序排列,且顺时针增大,左下角标号(1, 1),右上角标号(n, n) 现在告诉你矩阵中有m个数字被标记,并给出了标记数字的标号,然后给出p个...

weixin_44211980的博客 376

游戏开发实战:如何用旋转矩阵实现2D角色平滑转向(附Unity代码)

本文深入探讨了在Unity游戏开发中,如何运用旋转矩阵原理实现2D角色的平滑转向。文章从核心理论出发,提供了计算目标旋转、实现平滑插值(Lerp与SmoothDamp)的完整C#代码,并解决了与动画系统、物理引擎协同的常见难题,帮助开发者提升游戏操作手感与视觉流畅度。

weixin_29057237的博客 287

The Preliminary Contest for ICPC Asia Nanjing 2019 F. Greedy Sequence

The Preliminary Contest for ICPC Asia Nanjing 2019 F.Greedy Sequence 题目链接 You’re given a permutation aa of length n(1≤n≤105)n (1 \le n \le 10^5)n(1≤n≤105). For each i∈[1,n]i\in [1,n]i∈[1,n], construct a sequence sis_isi​ by the following rules: si[1]=is

旺崽的博客 2597

告别手动抓信号!Synopsys AXI VIP的Port Monitor实战:5分钟搞定与Scoreboard的TLM连接

本文详细介绍了Synopsys AXI VIP的Port Monitor功能,帮助验证工程师快速实现与Scoreboard的TLM连接,5分钟内完成自动数据收集。通过实战指南和常见问题排查,提升验证效率,告别手动抓信号的繁琐流程。

weixin_30565327的博客 300

如何使用 Ansys OptiSlang 同时运行多个参数化设计研究

了解如何通过使用 OptiSLang 同时运行多个参数化设计研究来提高工作效率。

jkh920184196的博客 2387

The Preliminary Contest for ICPC Asia Nanjing 2019 E K Sum

The Preliminary Contest for ICPC Asia Nanjing 2019 E题 K Sum 题意:定义 fn(k)=∑l1=1n∑l2=1n…∑lk=1n(gcd(l1,l2,…,lk))2f_n(k)=\sum\limits_{l_1=1}^{n}\sum\limits_{l_2=1}^{n}…\sum\limits_{l_k=1}^{n}(gcd(l_1,l_2,…...

tirion_chenrui的博客 215

知识图谱本体建模之RDF、RDFS、OWL详解

(一)知识图谱本体建模之RDF、RDFS、OWL详解 1.语义网体系 知识图谱于2012年由Google提出,并不是新概念,而是由语义网络(Semantic Network)衍生而来。语义网络由相互连接的节点和边组成,节点表示概念或者对象,边表示他们之间的关系。RDF,RDFS与OWL都是基于语义网的知识表示框架,在节点和边的取值上做了约束,制定了统一标准,为多源数据的融合提供了便利。RDF,RDFS/OWL 属于语义网技术栈,它们的提出,使得语义网克服了语义网络的缺点。其语义网技术栈如下所示。 2.RD

周周的专栏 1万+

补题 The Preliminary Contest for ICPC Asia Nanjing 2019

B super_log 链接:https://nanti.jisuanke.com/t/41299 题目意思:求a ^a ^a …… ^a (b个a)对m取模的结果。 思路:欧拉降幂。这题一开始想得复杂了,考虑了扩展欧拉降幂,因为取模的m与a可能不互质,后来发现并不需要,直接写就好了。 代码: #include<bits/stdc++.h> using namespace std; t...

xiayuccc的博客 341

服务器搭建原神私服教程

项目的稳定版分支提供了编译好的服务端程序,但是博主觉得还是用dev版本的比较好。dev版本需要自己编译的,不要听到编译这两个字就头大,相反,这个服务端的编译相当简单。把文件中的两个IP地址127.0.0.1修改为你服务器的地址,修改完成后按 esc 输入 :wq。Mongodb作为服务端的数据库使用,我们这里安装最新版的Mongodb5。注意:如果想要使用最新版的服务端,必须安装>=17版本的java。tmux可以保证你关掉控制台的时候,程序依然继续运行。至此,服务端所需要的运行环境全部配置完成。

用最简单的方式说最重要的事!服务器、存储、云计 算、A智能的大数据产品、游戏开发技术。致力于广 大开发者、政企用户、各项机构等,构建云上世界提供全方位云计算解决方案。旨在打造差异化的开放式闭环生态系统帮助用户快速构建稳定、安全的云计算环境。 1万+

IgH EtherCAT 从入门到精通:第 4 章 网络设备驱动选型与配置

摘要:本章详细介绍了EtherCAT主站网络设备驱动的选型与配置。IgH EtherCAT Master提供Generic通用驱动和Native原生驱动两种方案:Generic驱动通过Linux Socket接口实现,兼容性强但实时性较差;Native驱动通过修改网卡驱动绕过内核协议栈,具有更低延迟和更小抖动。文章具体分析了e1000/e1000e/igb/igc等Intel网卡驱动以及r8169/8139too等Realtek驱动的配置方法,并提供了驱动选型建议。对于实时性要求高的场景,推荐使用Nativ

从事嵌入式linux android驱动开发,拥有全栈能力 304

The Preliminary Contest for ICPC Asia Nanjing 2019 B:super_log

super_log 题意是有个一函数log a*(x) ,x<1时为-1,x>1为1+log a*(log a(x)) 给你a,b,m让求最小使不等式(log a*(x)>=b)成立的最小x%m 这题可以转换为求a的a次方的a次方…b个,模于m。 求幂可以用快速幂,然后必须降幂,因为m不一定是素数,所以这里就要用广义欧拉降幂来降幂了,否则幂就会因为太大而出错。 广义欧拉降幂需要求...

xfx's blog 7531

JAVA:Spring Boot 集成 LibreOffice 实现文档在线转换服务

本文介绍了在企业级应用开发中使用LibreOffice实现文档格式转换的技术方案。通过对比分析商业库、纯Java方案和云服务API的优缺点,重点阐述了LibreOffice在格式兼容性、转换质量和零成本方面的优势。文章详细说明了环境准备步骤,包括Windows/Linux系统安装LibreOffice、解决中文乱码问题以及Docker部署方案。最后提供了Spring Boot项目的基本配置,包括Maven依赖和application.yml配置文件,为构建稳定高效的文档转换服务奠定基础。

木头 520

The Preliminary Contest for ICPC Asia Nanjing 2019 A

https://nanti.jisuanke.com/t/41298 #include <bits/stdc++.h> #define MAXN 1000006 #define MAXQ 100005 #define MAXM 100005 #define ask 0 #define add 1 using namespace std; int T,n,m,q; struct p...

吉良吉影的博客 332

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

The Preliminary Contest for ICPC Asia Nanjing 2019 H. Holy Grail

The Preliminary Contest for ICPC Asia Nanjing 2019 H. Holy Grail 题目链接 As the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of sixty years

旺崽的博客 2624

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

The Preliminary Contest for ICPC Asia Nanjing 2019 B. super_log

The Preliminary Contest for ICPC Asia Nanjing 2019 B. super_log #include<bits/stdc++.h> using namespace std; typedef long long ll; ll a,b,mod; ll MOD(ll a,ll b){return a<b?a:a%b+b;} ll power(ll a,ll b,ll mod){return b?MOD(power(MOD(a*a,mod),b/2,m

旺崽的博客 2656

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

The Preliminary Contest for ICPC Asia Nanjing 2019 南京网络赛

H 最短路 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 300 + 5; const ll inf = 1e17; ll d[maxn][maxn]; int main() { int t; scanf("%d", &t); whi...

weixin_40588429的博客 218

The Preliminary Contest for ICPC Asia Nanjing 2019 D Robots

Robots Given a directed graph with no loops which starts at node 11 and ends at node nn. There is a robot who starts at 11, and will go to one of adjacent nodes or stand still with equal probability e...

逝者如斯夫,不舍昼夜 235

The Preliminary Contest for ICPC Asia Nanjing 2019【A B D E F】

题目地址:The Preliminary Contest for ICPC Asia Nanjing 2019 F. Greedy Sequence 题意: 题意有点绕,自己读吧 分析: 首先题目要求字典序最大,假设Sk在A数组的位置是pos,那么Sk的下一个数Sk+1一定是A[pos-k......pos+k]中小于Sk的最大值,类似dp的思想,以Sk开头的序列中不为0的数dp[S...

KobeDuu 748
上一篇: AtCoder Beginner Contest 139
下一篇: 牛客练习赛51 A-E
陶鸿杰
博客等级 码龄9年 93粉丝 298原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值