• The Kingdom of Byteland decided to develop a large computer network of servers offering various services. The network is built of n servers connected by bidirectional wires. Two servers can be ...
• There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer from 1 to n. It is known that during the day q tasks will come, the i-th
按照时间顺序，模拟一下就行了

There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer from 1 to n.
It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti —
the moment in seconds in which the task will come, ki — the number of servers needed to perform it, and di —
the time needed to perform this task in seconds. All ti are distinct.
To perform the i-th task you need ki servers which are unoccupied in the second ti.
After the servers begin to perform the task, each of them will be busy over the next di seconds. Thus, they will be busy in seconds ti, ti + 1, ..., ti + di - 1.
For performing the task, kiservers with the smallest ids will be chosen from all the unoccupied servers. If in the second ti there
are not enough unoccupied servers, the task is ignored.
Write the program that determines which tasks will be performed and which will be ignored.

Input

The first line contains two positive integers n and q (1 ≤ n ≤ 100, 1 ≤ q ≤ 105)
— the number of servers and the number of tasks.
Next q lines contains three integers each, the i-th line contains integers ti, ki and di (1 ≤ ti ≤ 106, 1 ≤ ki ≤ n, 1 ≤ di ≤ 1000) —
the moment in seconds in which the i-th task will come, the number of servers needed to perform it, and the time needed to perform this task in seconds. The tasks are given in a chronological order and they will come
in distinct seconds.

Output

Print q lines. If the i-th task will be performed by the servers, print in the i-th line the sum of servers' ids on which this task will
be performed. Otherwise, print -1.

Example

Input
4 3
1 3 2
2 2 1
3 4 3

Output
6
-1
10

Input
3 2
3 2 3
5 1 2

Output
3
3

Input
8 6
1 3 20
4 2 1
6 5 5
10 1 1
15 3 6
21 8 8

Output
6
9
30
-1
15
36

Note

In the first example in the second 1 the first task will come, it will be performed on the servers with ids 1, 2 and 3 (the sum of the
ids equals 6) during two seconds. In the second 2 the second task will come, it will be ignored, because only the server 4 will be unoccupied at that second. In the second 3 the
third task will come. By this time, servers with the ids 1, 2 and 3 will be unoccupied again, so the third task will be done on all the servers with the ids 1, 2, 3 and 4 (the
sum of the ids is 10).
In the second example in the second 3 the first task will come, it will be performed on the servers with ids 1 and 2 (the sum of the ids is 3)
during three seconds. In the second 5 the second task will come, it will be performed on the server 3, because the first two servers will be busy performing the first task.

#include<stdio.h>
#include<queue>
using namespace std;
struct list
{
int t;
int k;
int d;
}an[100005];
int main()
{
{
scanf("%d%d%d",&an[i].t,&an[i].k,&an[i].d);
}
{
int num=0,j=1,ans=0,ser=n;
if(an[i].k>n)
{
printf("-1\n");
continue;
}
while(j<=n)
{
if(time[j]<=an[i].t)
{
num++;
}
if(num==an[i].k)
break;
j++;
}
j=1;
if(num==an[i].k)
{
int cnt=0;
while(j<=n)
{
if(time[j]<=an[i].t)
{
ans+=j;
time[j]=an[i].t+an[i].d;
cnt++;
}
if(cnt==an[i].k)
break;
j++;
}
printf("%d\n",ans);
}
else
{
printf("-1\n");
continue;
}
}
return 0;
}


展开全文
• 《JBoss管理与开发核心技术（第三版）》 Tomcat
 《JBoss管理与开发核心技术（第三版）》
Tomcat

展开全文
• s using the --servers option? <p>I tried following syntaxes: <p>genghisapp --servers URI-1 URI-2 genghisapp --servers "URI-1 URI-2" genghisapp --servers URI-1 --servers URI-2 genghisapp --...
• <div><p>Found that <code>api.servers.servers</code> was empty when returning data to the client from an action. Looks like it was defined as an Array but then subsequently is used as an Object. ...
• <div><p>I know I have seen various threads that recommend using Batcache if you have mutiple servers. However, our site scales up and down and most of the time only has one server. Also, I like how ...
• Servers Ultimate,可以把安卓手机变成任意服务器，需要下载数据包
• 问题描述 本地编译的Nacos-1.0 ...failed to req API:/nacos/v1/ns/instance after all servers([127.0.0.1:8848]) 网上查询说是因为以集群方式启动导致的，更改为单机模式启动即可（standalone）。 有三种解决方式
问题描述
本地源码编译Nacos-1.0 master分支，配置好mysql后，作为服务中心和配置中心启动成功
但是网关应用启动时报错500 空指针异常。

failed to req API:/nacos/v1/ns/instance after all servers([127.0.0.1:8848])

网上查询说是因为以集群方式启动导致的，更改为单机模式启动即可（standalone）。
但是源码不是很熟，配置里改貌似没起效。
解决方式
方法一
临时先在nacos-console项目中的main方法里加了系统配置后，正常使用，我这里使用的是嵌入式数据库。
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos")
@ServletComponentScan
@EnableScheduling
public class Nacos {

public static void main(String[] args) {
System.setProperty("nacos.standalone", "true");
SpringApplication.run(Nacos.class, args);
}
}


暂时不清楚在配置文件里配的nacos.standalone=true不生效具体原因，可能是放错了文件，有机会再填坑

方法二
（本地未编译的项目和已编译的包都有效）
添加启动参数-Dnacos.standalone=true
方法三
如果下载的是已编译完成的nacos。可以直接加命令启动
./bin/startup.sh -m standalone
统一回复下评论

我这个是本地源码编译启动和测试的时候遇到的问题。
如果是集群模式报错，建议查阅官方文档和issue，检查部署环境、配置文件、IP地址。
如果IP地址有问题可以参考这篇文章：https://blog.csdn.net/zimou5581/article/details/91041239


展开全文
• <div><p>add a feature to allow your servers to be sorted in the list by name,node,usage,status. it would make for finding servers quite a bit easier on the list. <p>maybe also make it so you can ...
• web servers

web servers

展开全文
• <p>Failover servers need to be synchronized with primary ldap servers in case of failure. The synchronized servers will be able to retrieve the data if the primary server goes down</p><p>该提问来源于...
• ASGI Servers Server name HTTP/2 Server Push Websocket Response Hypercorn ✓ ✓ ✓ Uvicorn ✗ ...
• <div><p>c-ares currently reads system DNS servers only on init therefore any changes by system settings or by other apps made to them after it's been initialized won't be reflected in <code>...
• WSGI Servers A Web Server Gateway Interface (WSGI) server implements the web server side of the WSGI interface for running Python web applications. Why is WSGI necessary? A traditional web serve...
• <p>Also removed logic to only compare least_preferred_zone_ids if least_preferred_servers was not to be ignored, since it is possible for server_infos to contain all of the least_preferred_servers and...
• Sub-servers and alias servers though start with 1 or 2 spaces so it will be listed at top of the list. Can that be changed to have sub-servers and alias servers listed just below its parent server? ...
• 如题。 一直以来使用MyEclipse和Eclipse加载项目所使用的Tomcat一直都有个问题，就是Eclipse需要配置Tomcat的...今天在MyEclipse调试代码的时候发现有一个WTPServers窗口，出于郁闷研究了一番。 经过研究...
• <div><p>The cluster of multiple jsreport servers currently requires having static templates or a store like mongodb. The static templates are sometimes not an option because developers wants to edit ...
• <div><p>We should try to have some built-in scheduled jobs to move segments from realtime servers to offline servers. So that users don't need to setup external jobs to push segments from external...
• <p>Also removed logic to only compare least_preferred_zone_ids if least_preferred_servers was not to be ignored, since it is possible for server_infos to contain all of the least_preferred_servers and...
• i was installed Scalelite Lazy Deployment from <a href="https://medium.com//scalelite-lazy-deployment-745a7be849f6">here</a> with 9 servers. it's work correctly but after some days, around a week,...
• servers
• 使用过MyEclipse的用户，大都可能会遇到找不到Servers窗口（标签）的问题，这里我就简单给大家介绍一下找回Servers窗口和显示Servers窗口的方法，当然其他窗口也类似。 1、运行MyEclipse； 2、Search窗口丢失； 3...
• No backend servers available

...