penguin_is_cool @ 2023-12-28 19:17:27
1、各位大佬,请问为什么用c++14 (GCC 9)是3个TLE,而c++20却是4个TLE。
2、到老能帮我改一下我的代码吗?(超时):
#include <iostream>
using namespace std;
int main(){
int n,m,d=0;
cin>>n>>m;
int a[n],b[m];
for (int i=0;i<n;i++){
cin>>a[i];
}
for (int i=0;i<m;i++){
cin>>b[i];
d=0;
for (int o=0;o<n;o++){
if (a[o]==b[i]){
d++;
cout<<o+1<<" ";
break;
}
}
if (d==0)cout<<-1<<" ";
}
}
by wangzqh @ 2023-12-28 19:19:07
二分呀
by 2021zjhs005 @ 2023-12-28 19:19:57
建议二分。 @penguin_is_cool
by wangzqh @ 2023-12-28 19:20:08
建议题前先看数据范围
by wangzqh @ 2023-12-28 19:20:43
做
by penguin_is_cool @ 2023-12-28 19:21:57
@wangzqh @2021zjhs005 好的3Q