QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235765#7118. Closing Time275307894a#0 0ms4192kbC++141.4kb2023-11-03 08:50:452024-04-28 07:56:30

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 07:56:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:4192kb
  • [2023-11-03 08:50:45]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:4180kb
  • [2023-11-03 08:50:45]
  • 提交

answer

#include "closing.h"
#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=2e3+5,M=5e5+5,K=(1<<25)+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n;ll k;vector<pii> S[N];
ll d1[N],d2[N];
void Make(int x,int La,ll *d){
	for(auto i:S[x]) if(i.fi^La) d[i.fi]=d[x]+i.se,Make(i.fi,x,d);
}
struct node{
	ll x,w1,w2;
}A[N];
int max_score(int nn,int X,int Y,ll kk,vector<int> U,vector<int> V,vector<int> W){
    int i,j;n=nn;k=kk;for(i=0;i<n;i++) S[i].clear();
	for(int i=0;i<n-1;i++) S[U[i]].emplace_back(V[i],W[i]),S[V[i]].emplace_back(U[i],W[i]);
	d1[X]=d2[Y]=0;Make(X,0,d1);Make(Y,0,d2);
	k*=2;
	for(int i=0;i<n;i++) d1[i]*=2,d2[i]*=2;
	priority_queue<pair<ll,int> > q;
	int ans=0;
	int tot=0;
	for(i=0;i<n;i++) q.emplace(-d1[i],0),q.emplace(-d2[i],0);
	ll m=k;
	while(!q.empty()){
		auto p=q.top();q.pop();
		p.fi*=-1;
		if(m>=p.fi) m-=p.fi,tot++;
		else break;
	}
	ans=max(ans,tot);
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 31011 61157 8517583098
31011 129396 964383
1655 129396 331139
1655 191487 566483
110385 191487 865248
43212 110385 542661
43212 81682 13766
81682 91774 546589
91774 124706 780638
124706 175650 118706
10421 175650 615314
10421 151953 436270
140430 151...

output:


result:


Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 4192kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 23 25 382806473
0 1 375710
1 2 898637
2 3 10402
3 4 536577
4 5 385023
5 6 71075
6 7 543368
7 8 301497
8 9 174394
9 10 711312
10 11 923006
11 12 675532
12 13 838667
13 14 565729
14 15 979816
15 16 862618
16 17 576015
17 18 177751
18 19 306989
19 20 881492...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
71

result:

wrong answer 1st lines differ - on the 1st token, expected: '96', found: '71'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Wrong Answer

Test #36:

score: 0
Wrong Answer
time: 0ms
memory: 3932kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
4 0 1 9
0 2 2
1 2 3
2 3 3

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

wrong answer 1st lines differ - on the 1st token, expected: '6', found: '4'

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%