CF150E Freezing with Style 题解

CF150E Freezing with Style

经典的更优复杂度不会,大众分都懂。

就是对于中位数的话进行树上路径合并很难处理,那么我们不妨二分中位数,之后将 ≥ \ge 的数作为 1 1 1,否则就是 − 1 -1 1。那么合法的一条路径肯定是权值和 ≥ 0 \ge 0 0

前面取等号是题目的要求。

那么对于一条路径如果其长度是 l e n \tt len len 那么我们合法的配对路径的取值范围就是 [ L − l e n , R − l e n ] \tt[L - len, R - len] [Llen,Rlen]

因为要使其合法所以我们只要使用这个区间的最大值就好了。如果我们将路径长度从大到小排序,那么这个区间就是逐渐向右移动,本质上就是一个滑动窗口问题。

那么我们合并就可以处理了,具体来说就是将之前子树的信息记录,之后枚举当前子树的中路径的长度(这里相同长度的路径显然只要考虑权值最大的一个)。每次更新一下滑动窗口的区间即可。

最后我们再将当前子树和之前合并就好了。


一些代码中使用的数组:

Dp[i]:已经处理过的子树中深度为 i i i 的最大权值的节点编号。

Dmx[i]:已经处理过的子树中深度为 i i i 的最大权值。

dp[i]:正在处理过的子树中深度为 i i i 的最大权值的节点编号。

dmx[i]:正在处理过的子树中深度为 i i i 的最大权值。

Mdep:已经处理过的子树中的最大深度。

#include <bits/stdc++.h>
using namespace std;

//#define Fread
//#define Getmod

#ifdef Fread
char buf[1 << 21], *iS, *iT;
#define gc() (iS == iT ? (iT = (iS = buf) + fread (buf, 1, 1 << 21, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
#define getchar gc
#endif // Fread

template <typename T>
void r1(T &x) {
	x = 0;
	char c(getchar());
	int f(1);
	for(; c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
	for(; '0' <= c && c <= '9';c = getchar()) x = (x * 10) + (c ^ 48);
	x *= f;
}

template <typename T,typename... Args> inline void r1(T& t, Args&... args) {
    r1(t);  r1(args...);
}

//#define int long long
const int maxn = 2e5 + 5;
const int maxm = maxn << 1;

struct Edge {
    int v, w;
};

vector<Edge> vc[maxn];

int siz[maxn], mx[maxn], mxdep[maxn], dep1[maxn], vis[maxn];
int Rt, Mx, All;
void getrt(int p,int pre) {
//    printf("p = %d\n", p);
    siz[p] = 1, mx[p] = 0, mxdep[p] = dep1[p];
    for(auto v : vc[p]) {
        if(v.v == pre || vis[v.v]) continue;
        dep1[v.v] = dep1[p] + 1;
        getrt(v.v, p);
        siz[p] += siz[v.v];
        mx[p] = max(mx[p], siz[v.v]);
        mxdep[p] = max(mxdep[p], mxdep[v.v]);
    }
    mx[p] = max(mx[p], All - siz[p]);
    if(mx[p] < Mx) Rt = p, Mx = mx[p];
}

int L, R, dis[maxn], Dep[maxn], Ansu, Ansv, M;
int buc[maxn], fa[maxn];

int bfs(int st) {
    int tot(0);
    buc[++ tot] = st;
    static queue<int> q; while(!q.empty()) q.pop();
    q.push(st);
    while(!q.empty()) {
        int u = q.front(); q.pop();
        for(auto v : vc[u]) if(v.v != fa[u] && !vis[v.v]) {
            fa[v.v] = u, Dep[v.v] = Dep[u] + 1; dis[v.v] = dis[u] + (v.w >= M ? 1 : -1);
            buc[++ tot] = v.v;
            q.push(v.v);
        }
    }
    return tot;
}

int q[maxn], Dmx[maxn], Dp[maxn], dmx[maxn], dp[maxn], Mdep;
const int inf = 0x3f3f3f3f;

int Calc(int p) {
    int Len = bfs(p);
    for(int i = 1; i <= Len; ++ i) if(dmx[Dep[buc[i]]] < dis[buc[i]]) {
        dmx[Dep[buc[i]]] = dis[buc[i]];
        dp[Dep[buc[i]]] = buc[i];
    }
    int hd(1), tl(0);
    int flag(0);
    for(int i = mxdep[p], j = 0; i; -- i) {
        int ll = L - i, rr = R - i;
        if(ll > Mdep) break;
        j = max(j, ll);
        for(; j <= rr && j <= Mdep; ++ j) {
            for(; hd <= tl && Dmx[q[tl]] <= Dmx[j]; -- tl);
            q[++ tl] = j;
        }
        for(; hd <= tl && q[hd] < ll; ++ hd);
        if(hd <= tl && Dmx[q[hd]] + dmx[i] >= 0) {
            Ansu = dp[i], Ansv = Dp[q[hd]]; // Dp[i] 表示深度为 i 的最大权值的位置
            flag = 1;
            break;
        }
    }

    Mdep = max(Mdep, mxdep[p]);

    for(int i = 1; i <= mxdep[p]; ++ i) if(Dmx[i] < dmx[i]) {
        Dmx[i] = dmx[i]; Dp[i] = dp[i];
        dp[i] = 0, dmx[i] = - inf;
    }

    return flag;
}

int dfs(int p) {
//    printf("p = %d\n", p);
    vis[p] = 1;
    sort(vc[p].begin(), vc[p].end(), [&] (const Edge &a, const Edge &b) {
        return mxdep[a.v] < mxdep[b.v];
    });

    Dp[0] = p, Dmx[0] = 0;
    for(int i = 1; i <= mxdep[p]; ++ i) Dmx[i] = dmx[i] = - inf, Dp[i] = dp[i] = 0;
    Mdep = 0;

    for(auto v : vc[p]) if(!vis[v.v]) {
        fa[v.v] = p;
        dis[v.v] = (v.w >= M ? 1 : -1);
        Dep[v.v] = 1;
        if(Calc(v.v)) return 1;
    }
    for(auto v : vc[p]) if(!vis[v.v]) {
        All = siz[v.v];
        Mx = 2e9, getrt(v.v, p);
        dep1[Rt] = 0;
        getrt(Rt, 0);
        if(dfs(Rt)) return 1;
    }
    return 0;
}
int val[maxn], n;
signed main() {
//    freopen("S.in", "r", stdin);
//    freopen("S.out", "w", stdout);
    int i, j;
    r1(n, L, R);
    for(i = 1; i < n; ++ i) {
        int u, v, w;
        r1(u, v, w);
        auto add = [&] (int u,int v,int w) {
            vc[u].push_back((Edge) {v, w});
        };
        add(u, v, w), add(v, u, w);
        val[i] = w;
    }
    sort(val + 1, val + n);
    int mid, l(1), r(n - 1), ansu, ansv, ansmid;
    while(l <= r) {
        mid = (l + r) >> 1;
        memset(vis, 0, sizeof(vis));
        M = val[mid];
        Mx = 2e9, All = n;
        getrt(1, 0); dep1[Rt] = 0;
//    puts("ZZZ");
        getrt(Rt, 0);
        if(dfs(Rt)) l = mid + 1, ansu = Ansu, ansv = Ansv, ansmid = mid;
        else r = mid - 1;
    }
//    printf("ansmid = %d\n", val[ansmid]);
    printf("%d %d\n", ansu, ansv);
	return 0;
}
pip install gensim -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting gensim Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ec/bc/36ce4d510085cf150f17d79bb5e88cde942aeba2a894aed5893812ea1e6d/gensim-4.3.3.tar.gz (23.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy<2.0,>=1.18.5 (from gensim) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/65/6e/09db70a523a96d25e115e71cc56a6f9031e7b8cd166c1ac8438307c14058/numpy-1.26.4.tar.gz (15.8 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Collecting scipy<1.14.0,>=1.7.0 (from gensim) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ae/00/48c2f661e2816ccf2ecd77982f6605b2950afe60f60a52b4cbbc2504aa8f/scipy-1.13.1.tar.gz (57.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [47 lines of output] + meson setup C:\Users\22812\AppData\Local\Temp\pip-install-zl3_wayd\scipy_5e750115cbb143979863780a344bb3fe C:\Users\22812\AppData\Local\Temp\pip-install-zl3_wayd\scipy_5e750115cbb143979863780a344bb3fe\.mesonpy-j_r1blru -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\22812\AppData\Local\Temp\pip-install-zl3_wayd\scipy_5e750115cbb143979863780a344bb3fe\.mesonpy-j_r1blru\meson-python-native-file.ini The Meson build system Version: 1.9.1 Source dir: C:\Users\22812\AppData\Local\Temp\pip-install-zl3_wayd\scipy_5e750115cbb143979863780a344bb3fe Build dir: C:\Users\22812\AppData\Local\Temp\pip-install-z
10-14
14:13:40.801 [ForkJoinPool.commonPool-worker-3] ERROR druid.sql.Statement - [statementLogError,148] - {conn-10003, pstmt-20025} execute error. INSERT INTO ai_event_payload(send_time, ability, event_id, src_index, src_type, src_name, event_type, happen_time, stop_time, location_name, handle_status, event_level, remark, first_remind_time, last_remind_time, remind_count, two_remind_time,pic_uri, svr_index_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?,?,?) on duplicate key update send_time = VALUES (send_time), ability = VALUES (ability), src_index = VALUES (src_index), src_type = VALUES (src_type), src_name = VALUES (src_name), event_type = VALUES (event_type), happen_time = VALUES (happen_time), stop_time = VALUES (stop_time), location_name = VALUES (location_name), handle_status = VALUES (handle_status), event_level = VALUES (event_level), remark = VALUES (remark), first_remind_time = VALUES (first_remind_time), last_remind_time = VALUES (last_remind_time), remind_count = VALUES (remind_count), two_remind_time = VALUES (two_remind_time), pic_uri = VALUES (pic_uri), svr_index_code = VALUES (svr_index_code) com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:124) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3446) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:152) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64) at com.sun.proxy.$Proxy255.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) at com.sun.proxy.$Proxy138.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy189.insertEventPayload(Unknown Source) at com.gcvcloud.interfaceservice.service.HaiKangService.processSingleEvent(HaiKangService.java:154) at com.gcvcloud.interfaceservice.service.HaiKangService.processWarnings(HaiKangService.java:62) at com.gcvcloud.interfaceservice.service.HaiKangService$$FastClassBySpringCGLIB$$f94d55fb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at com.gcvcloud.interfaceservice.service.HaiKangService$$EnhancerBySpringCGLIB$$cf150d9b.processWarnings(<generated>) at com.gcvcloud.interfaceservice.controller.WarningNotificationController.lambda$handleEvent$0(WarningNotificationController.java:48) at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 14:13:40.801 [ForkJoinPool.commonPool-worker-1] ERROR druid.sql.Statement - [statementLogError,148] - {conn-10005, pstmt-20041} execute error. INSERT INTO ai_event_payload(send_time, ability, event_id, src_index, src_type, src_name, event_type, happen_time, stop_time, location_name, handle_status, event_level, remark, first_remind_time, last_remind_time, remind_count, two_remind_time,pic_uri, svr_index_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?,?,?) on duplicate key update send_time = VALUES (send_time), ability = VALUES (ability), src_index = VALUES (src_index), src_type = VALUES (src_type), src_name = VALUES (src_name), event_type = VALUES (event_type), happen_time = VALUES (happen_time), stop_time = VALUES (stop_time), location_name = VALUES (location_name), handle_status = VALUES (handle_status), event_level = VALUES (event_level), remark = VALUES (remark), first_remind_time = VALUES (first_remind_time), last_remind_time = VALUES (last_remind_time), remind_count = VALUES (remind_count), two_remind_time = VALUES (two_remind_time), pic_uri = VALUES (pic_uri), svr_index_code = VALUES (svr_index_code) com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:124) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3446) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:152) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64) at com.sun.proxy.$Proxy255.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) at com.sun.proxy.$Proxy138.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy189.insertEventPayload(Unknown Source) at com.gcvcloud.interfaceservice.service.HaiKangService.processSingleEvent(HaiKangService.java:154) at com.gcvcloud.interfaceservice.service.HaiKangService.processWarnings(HaiKangService.java:62) at com.gcvcloud.interfaceservice.service.HaiKangService$$FastClassBySpringCGLIB$$f94d55fb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at com.gcvcloud.interfaceservice.service.HaiKangService$$EnhancerBySpringCGLIB$$cf150d9b.processWarnings(<generated>) at com.gcvcloud.interfaceservice.controller.WarningNotificationController.lambda$handleEvent$0(WarningNotificationController.java:48) at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 14:13:42.766 [ForkJoinPool.commonPool-worker-7] ERROR druid.sql.Statement - [statementLogError,148] - {conn-10007, pstmt-20047} execute error. INSERT INTO ai_event_payload(send_time, ability, event_id, src_index, src_type, src_name, event_type, happen_time, stop_time, location_name, handle_status, event_level, remark, first_remind_time, last_remind_time, remind_count, two_remind_time,pic_uri, svr_index_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?,?,?) on duplicate key update send_time = VALUES (send_time), ability = VALUES (ability), src_index = VALUES (src_index), src_type = VALUES (src_type), src_name = VALUES (src_name), event_type = VALUES (event_type), happen_time = VALUES (happen_time), stop_time = VALUES (stop_time), location_name = VALUES (location_name), handle_status = VALUES (handle_status), event_level = VALUES (event_level), remark = VALUES (remark), first_remind_time = VALUES (first_remind_time), last_remind_time = VALUES (last_remind_time), remind_count = VALUES (remind_count), two_remind_time = VALUES (two_remind_time), pic_uri = VALUES (pic_uri), svr_index_code = VALUES (svr_index_code) com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:124) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3446) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:152) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64) at com.sun.proxy.$Proxy255.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) at com.sun.proxy.$Proxy138.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy189.insertEventPayload(Unknown Source) at com.gcvcloud.interfaceservice.service.HaiKangService.processSingleEvent(HaiKangService.java:154) at com.gcvcloud.interfaceservice.service.HaiKangService.processWarnings(HaiKangService.java:62) at com.gcvcloud.interfaceservice.service.HaiKangService$$FastClassBySpringCGLIB$$f94d55fb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at com.gcvcloud.interfaceservice.service.HaiKangService$$EnhancerBySpringCGLIB$$cf150d9b.processWarnings(<generated>) at com.gcvcloud.interfaceservice.controller.WarningNotificationController.lambda$handleEvent$0(WarningNotificationController.java:48) at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 14:29:56.025 [ForkJoinPool.commonPool-worker-7] ERROR druid.sql.Statement - [statementLogError,148] - {conn-10007, pstmt-20029} execute error. INSERT INTO ai_event_payload(send_time, ability, event_id, src_index, src_type, src_name, event_type, happen_time, stop_time, location_name, handle_status, event_level, remark, first_remind_time, last_remind_time, remind_count, two_remind_time,pic_uri, svr_index_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?,?,?) on duplicate key update send_time = VALUES (send_time), ability = VALUES (ability), src_index = VALUES (src_index), src_type = VALUES (src_type), src_name = VALUES (src_name), event_type = VALUES (event_type), happen_time = VALUES (happen_time), stop_time = VALUES (stop_time), location_name = VALUES (location_name), handle_status = VALUES (handle_status), event_level = VALUES (event_level), remark = VALUES (remark), first_remind_time = VALUES (first_remind_time), last_remind_time = VALUES (last_remind_time), remind_count = VALUES (remind_count), two_remind_time = VALUES (two_remind_time), pic_uri = VALUES (pic_uri), svr_index_code = VALUES (svr_index_code) com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:124) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3446) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3444) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:152) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64) at com.sun.proxy.$Proxy255.update(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) at com.sun.proxy.$Proxy138.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy189.insertEventPayload(Unknown Source) at com.gcvcloud.interfaceservice.service.HaiKangService.processSingleEvent(HaiKangService.java:154) at com.gcvcloud.interfaceservice.service.HaiKangService.processWarnings(HaiKangService.java:62) at com.gcvcloud.interfaceservice.service.HaiKangService$$FastClassBySpringCGLIB$$f94d55fb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at com.gcvcloud.interfaceservice.service.HaiKangService$$EnhancerBySpringCGLIB$$d0369729.processWarnings(<generated>) at com.gcvcloud.interfaceservice.controller.WarningNotificationController.lambda$handleEvent$0(WarningNotificationController.java:48) at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)什么错误
10-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值