臭大佬_LZW
Posted nublity
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了臭大佬_LZW相关的知识,希望对你有一定的参考价值。
SPJ
#pragma GCC optimize(2) #pragma GCC optimize(3, "Ofast", "inline") #include <bits/stdc++.h> #define ll long long #define met(a, x) memset(a,x,sizeof(a)) using namespace std; const int N = 3e5 + 10; int a[N], b[N], c[N]; map<int, int> mp; //char argc[10][10100]; int main(int argc, char *args[]) { ifstream user, in, out; in.open(args[1]);//测试输入 out.open(args[2]);//测试输出 user.open(args[3]);//用户输出 int n; in >> n; for (int i = 1; i <= n; i++) { in >> a[i + n]; a[i] = a[i + n]; a[i + 2 * n] = a[i + n]; } for (int i = 1; i <= n; i++) { in >> b[i + n]; b[i] = b[i + n]; b[i + 2 * n] = b[i + n]; } int ans; out >> ans; if (ans == -1) { int x; user>>x; if(x!=ans)return 1; } else { for (int i = 1; i <= n; i++) { user >> c[i]; if (mp[c[i]])return 1; mp[c[i]]++; } int numa = 0, numb = 0; for (int i = 1; i <= n; i++) { if (a[i] == c[1])numa = i + n; if (b[i] == c[1])numb = i + n; } int l = numa - 1, r = numa + 1; for (int i = 2; i <= n; i++) { if (c[i] == a[l])l--; else if (c[i] == a[r])r++; else return 1; } l = numb - 1, r = numb + 1; for (int i = 2; i <= n; i++) { if (c[i] == b[l])l--; else if (c[i] == b[r])r++; else return 1; } } return 0; }
以上是关于臭大佬_LZW的主要内容,如果未能解决你的问题,请参考以下文章