QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#573674#9356. LRU Algorithmship2077WA 57ms105112kbC++23907b2024-09-18 19:37:342024-09-18 19:37:34

Judging History

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

  • [2024-09-26 19:14:31]
  • hack成功,自动添加数据
  • (/hack/913)
  • [2024-09-26 19:12:47]
  • hack成功,自动添加数据
  • (/hack/912)
  • [2024-09-18 19:37:34]
  • 评测
  • 测评结果:WA
  • 用时:57ms
  • 内存:105112kb
  • [2024-09-18 19:37:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=5005;
vector<int>vec[M];
int n,q,a[M],cnt[M];
int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x;
}
void solve(){
	n=read();q=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++) cnt[j]=0;
		vec[i].clear();
		for (int j=i;j;j--){
			if (cnt[a[j]]) continue; cnt[a[j]]=1;
			vec[i].emplace_back(a[j]);
		}
		vec[i].resize(n,0);
	}
	sort(vec+1,vec+n+1); while (q--){
		int m=read();vector<int>tmp;
		for (int i=1;i<=m;i++) tmp.emplace_back(read());
		int p=lower_bound(vec+1,vec+n+1,tmp)-vec;
		if (p>n) {puts("No");continue;}
		for (int i=0;i<m;i++)
			if (vec[p][i]!=tmp[i])
				{puts("No");goto fail;}
		puts("Yes");
		fail:;
	}
}
int main(){int T=read();while (T--) solve();return 0;}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3868kb

input:

1
7 5
4 3 4 2 3 1 4
1 4
2 2 3
3 3 2 1
4 4 1 3 2
4 3 4 0 0

output:

Yes
No
No
Yes
Yes

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 57ms
memory: 105112kb

input:

105
50 10
23 30 34 20 27 11 21 29 12 7 21 42 45 48 8 15 6 16 19 35 16 14 29 11 31 18 22 4 45 22 14 4 13 40 43 48 27 15 15 15 15 10 15 11 31 37 34 34 50 14
1 25
2 23 6
3 29 21 11
4 12 29 18 39
5 29 21 11 27 20
6 21 10 9 3 34 14
7 49 36 36 43 50 50 35
8 12 29 21 11 27 20 34 30
9 11 27 20 34 30 23 0 0 ...

output:

No
No
Yes
No
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
No
Yes
No
Yes
No
Yes
No
No
No
Yes
Yes
Yes
No
No
No
No
No
No
Yes...

result:

wrong answer 44th lines differ - expected: 'Yes', found: 'No'