QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#564891#8950. 树据结构Kevin090228🍬#0 107ms361848kbC++231.6kb2024-09-15 16:38:312024-09-15 16:38:31

Judging History

This is the latest submission verdict.

  • [2024-09-15 16:38:31]
  • Judged
  • Verdict: 0
  • Time: 107ms
  • Memory: 361848kb
  • [2024-09-15 16:38:31]
  • Submitted

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int n,q;
int p[100100],d[100100],c[100100],maxd;
int op[100100],x[100100],y[100100];
int po[100100],tot;
int in[100100][455],out[100100][455];
int ans[100100];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>q;
	for(int i=2;i<=n;i++)
		cin>>p[i];
	for(int i=1;i<=n;i++)
	{
		d[i]=d[p[i]]+1;
		c[d[i]]++;
	}
	maxd=*max_element(d+1,d+n+1);
	for(int i=1;i<=q;i++)
	{
		cin>>op[i];
		if(op[i]==1)
			cin>>x[i]>>y[i];
	}
	for(int i=1;i<=maxd;i++)
		if(c[i]!=c[i-1])
			po[++tot]=i;
	po[++tot]=maxd+1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=tot;j++)
			in[i][j]=inf;
	for(int i=n;i>=1;i--)
	{
		if(i>1)
			for(int j=1;j<=tot;j++)
			{
				in[p[i]][j]=min(in[p[i]][j],in[i][j]);
				out[p[i]][j]=max(out[p[i]][j],out[i][j]);
			}
		for(int j=1;j<=tot;j++)
			if(po[j]==d[i])
				in[i][j]=out[i][j]=i;
	}
	for(int i=1;i<tot;i++)
	{

	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 11604kb

input:

994 980
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 88 89 90 91 92 93 94 95 96 97 9...

output:


result:

wrong answer 1st lines differ - expected: '1003408', found: ''

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 101ms
memory: 358312kb

input:

98132 98277
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:


result:

wrong answer 1st lines differ - expected: '188162172', found: ''

Subtask #3:

score: 0
Wrong Answer

Test #25:

score: 0
Wrong Answer
time: 15ms
memory: 359944kb

input:

98694 98643
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:


result:

wrong answer 1st lines differ - expected: '1233260', found: ''

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 43ms
memory: 241908kb

input:

65535 98062
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...

output:


result:

wrong answer 1st lines differ - expected: '5623100', found: ''

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 32ms
memory: 361848kb

input:

99562 98687
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:


result:

wrong answer 1st lines differ - expected: '9056060', found: ''

Subtask #6:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 56ms
memory: 183352kb

input:

49861 49257
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:


result:

wrong answer 1st lines differ - expected: '150839800', found: ''

Subtask #7:

score: 0
Wrong Answer

Test #73:

score: 0
Wrong Answer
time: 107ms
memory: 356732kb

input:

98390 98942
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:


result:

wrong answer 1st lines differ - expected: '5600403', found: ''