QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#114258#5976. Fairlandzwh20080 143ms13972kbC++141.1kb2023-06-21 19:32:132023-06-21 19:32:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-21 19:32:15]
  • 评测
  • 测评结果:0
  • 用时:143ms
  • 内存:13972kb
  • [2023-06-21 19:32:13]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+5;
int n,D,now,cnt,Case,fa[N],h[N];
bool ok[N],vis[N];
struct node{int x,d;}a[N];
struct edge{int n,t;}e[N];
void add(int x,int y){e[++cnt]={h[x],y},h[x]=cnt;}
void dfs1(int x){ok[x]=1,now++;for(int i=h[x];i;i=e[i].n)if(vis[e[i].t])dfs1(e[i].t);}
void dfs2(int x){ok[x]=0,now--;for(int i=h[x];i;i=e[i].n)if(ok[e[i].t])dfs2(e[i].t);}
void Add(int x){vis[x]=1;if(x==1||ok[fa[x]])dfs1(x);}
void Del(int x){vis[x]=0;if(ok[x])dfs2(x);}
void solve() {
	int as,cs,rs,am,cm,rm;a[1].x=1,now=cnt=0,memset(h,0,sizeof(h));
	scanf("%d%d%d%d%d%d%d%d%d%d",&n,&D,&a[1].d,&as,&cs,&rs,fa+1,&am,&cm,&rm);
	for(int i=2;i<=n;i++)a[i]={i,(1ll*a[i-1].d*as+cs)%rs},fa[i]=(1ll*fa[i-1]*am+cm)%rm%(i-1)+1,add(fa[i],i),cout<<i<<" "<<fa[i]<<" "<<a[i].d<<endl;
	sort(a+1,a+n+1,[](node &x,node &y){return x.d<y.d;});
	int j=0,ans=0;
	for(int i=1;i<=n;i++) {
		while(j<n&&a[j+1].d<=a[i].d+D)Add(a[++j].x);
		ans=max(ans,now),Del(a[i].x);
	}
	printf("Case #%d: %d\n",++Case,ans);
}
int main() {
	int tt;scanf("%d",&tt);
	while(tt--)solve();
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 143ms
memory: 13972kb

input:

100
863 737
147 1 1 826
830 1 1 831
186 768
267 527 792527137 526
81 13 460856586 342
848 696
135 1 1 787
813 1 1 814
987 668
157 1 1 892
255 326 108399179 710
728 169
323 210 682026321 585
750 85 977096686 799
915 725
167 1 1 866
813 1 1 814
816 381
670 1 1 744
429 1 1 430
688 569
579 848 252088721...

output:

2 1 148
3 1 149
4 3 150
5 1 151
6 3 152
7 5 153
8 7 154
9 1 155
10 3 156
11 5 157
12 7 158
13 9 159
14 11 160
15 13 161
16 15 162
17 1 163
18 3 164
19 5 165
20 7 166
21 9 167
22 11 168
23 13 169
24 15 170
25 17 171
26 19 172
27 21 173
28 23 174
29 25 175
30 27 176
31 29 177
32 31 178
33 1 179
34 3 1...

result:

wrong answer 1st lines differ - expected: 'Case #1: 710', found: '2 1 148'

Subtask #2:

score: 0
Time Limit Exceeded

Test #2:

score: 0
Time Limit Exceeded

input:

100
1000 700
1 1 1 1000
999 1 1 1000
868238 873094
175212 1 946155217 409436
809287 1 1 809288
854112 678623
130672 1 1 789040
845767 1 1 845768
814744 420144
420003 1 1 803202
800344 1 1 800345
864316 383539
632857 1 1 703161
615175 55 522100274 984097
877988 440499
469030 1 1 839327
469558 1 1 469...

output:

2 1 2
3 1 3
4 3 4
5 1 5
6 3 6
7 5 7
8 7 8
9 1 9
10 3 10
11 5 11
12 7 12
13 9 13
14 11 14
15 13 15
16 15 16
17 1 17
18 3 18
19 5 19
20 7 20
21 9 21
22 11 22
23 13 23
24 15 24
25 17 25
26 19 26
27 21 27
28 23 28
29 25 29
30 27 30
31 29 31
32 31 32
33 1 33
34 3 34
35 5 35
36 7 36
37 9 37
38 11 38
39 13...

result: