dnsn7


私信TA

用户名:uq_85498979573

访问量:373

签 名:

等  级
排  名 42437
经  验 353
参赛次数 0
文章发表 2
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

解题思路:

我是来吐槽的,同样的代码,一下超时一下正确,服了
注意事项:

参考代码

#include<iostream>

#include<stdio.h>

#include<string>

#include<stdio.h>

#include<vector>

#include<unordered_map>

#include<math.h>

#include<queue>

#include<string.h>

#include<string>

#include<list>

#include<set>

#include<algorithm>

using namespace std;

#define ll long long

#define pii pair<ll,ll>

template<typename T> bool  mmax(T A, T B) {

return A > B ? true : false;

}

template<typename T> bool mmin(T a, T b) {

return a < b ? true : false;

}

#define IOS std::ios_base::sync_with_stdio(false);std::cin.tie(nullptr);std::cout.tie(nullptr);

inline ll read() {

ll s = 0, w = 0;

char c = getchar();

while (!isdigit(c))w |= (c == '-'), c = getchar();

while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();

return w ? -s : s;

}

//ll nextval[1005];//KMP

ll h[2005], f[2605], n, cnt, p, q;

set<ll>ss;

/*inline void get_next(string t) {

int j = 0, k = -1;

nextval[0] = -1;

while (j < t.length()) {

if (k == -1 || t[j] == t[k]) {

j++, k++;

if (t[j] != t[k]) nextval[j] = k;

else nextval[j] = nextval[k];

}

else k = nextval[k];

}

}

inline bool KMP(string s,string t){

get_next(t);

ll i = 0, j = 0,sl=s.length(),tl=t.length();

while (i < sl &&j < tl) {

if (j == -1 || s[i] == t[j])j++, i++;

else j = nextval[j];

}

if (j == tl) return true;

else return false;


}*/

inline void Init() {

for (int i = 0; i <= 2 * n; i++) f[i] = i;

}

ll Find(ll i) { return i == f[i] ? i : f[i] = Find(f[i]); }

inline void merge(ll a, ll b) {

ll fa = Find(a), fb = Find(b);

//if (fa != fb) {

f[fa] = fb;

//}

}

ll a[1000002], b[1000006];

unordered_map<ll, bool>aa;

unordered_map<ll, bool>bb;

int main() {

ll n = read(), m = read(),k=0;

for (int i = 0; i < n; i++) a[i] = read(),aa[a[i]]=true;

ll l1 = read(), r1 = read();

for (int i = l1-1 ; i < r1; i++) b[k++] = a[i];

//cout << k << endl;

memset(a, 0, sizeof(a));

for (int i = 0; i < m; i++) a[i] = read(), bb[a[i]] = true;

ll l2 = read(), r2 = read();

for (int i = l2-1 ; i < r2; i++) b[k++] = a[i];

sort(b, b + k);

for (int i = 0; i < k;i++) {

if (aa[b[i]]) printf("%d ", 1);

else printf("%d ", 2);

}

return 0;

}

:

 

0.0分

1 人评分

  评论区

  • «
  • »