RT , 所有点全部秒RE , 本地下载的测试点全过
可以排除是变量名的原因
就是这样一份丑陋的代码
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define enter putchar('\n')
#define space putchar(' ')
#define int long long
using namespace std;
const int inf = 0x3f3f3f3f;
void error()
{
printf("error!!!\n");
enter;
}
int n, m, t;
int Sentences, Complexity, Now_complexity, Num_for, Now_for, Max_complexity;
int Vis_variable[105], Now_variable[105], Complexity_variable[105];
bool Flag , Flag2;
string S1, S2;
signed main()
{
cin >> t;
while (t--)
{
Sentences = 0, Complexity = 0, Num_for = 0, Now_for = 0, Max_complexity = 0, Flag = false , Now_complexity = 0 , Flag2 = false;
memset(Vis_variable, 0, sizeof(Vis_variable));
memset(Now_variable, 0, sizeof(Now_variable));
memset(Complexity_variable, 0, sizeof(Complexity_variable));
cin >> Sentences >> S1;
for (int i = 4; i < S1.size() - 1; i++)
Complexity = Complexity * 10 + S1[i] - '0';
// cout <<S1<<endl <<Complexity << endl;
while (Sentences--)
{
cin >> S1;
if (S1[0] == 'F')
{
Num_for++;
cin >> S2;
if (Vis_variable[S2[0] - 'a'])
Flag2 = true; //ERR
else
Vis_variable[S2[0] - 'a'] = true, Now_variable[Num_for] = S1[0] - 'a';
cin >> S1 >> S2;
if (S1[0] != 'n' && S2[0] == 'n' && !Flag)
Now_complexity++, Complexity_variable[Num_for]++;
else if ((S1.size() == S2.size() && S1 > S2) || S1.size() > S2.size() || (S1[0] == n && S2[0] != n))
Flag = true, Now_for = Num_for;
}
if (S1[0] == 'E')
{
Max_complexity = max(Max_complexity, Now_complexity);
Vis_variable[Now_variable[Num_for]] = false;
Now_complexity -= Complexity_variable[Num_for];
Complexity_variable[Num_for] = 0;
Num_for--;
if (Now_for && Num_for < Now_for)
Flag = false, Now_for = 0 , Flag2 = false;
}
}
if (Num_for > 0 || Flag2) //too much fors
{
// if(Num_for)
// cout << "Num_for : " << Num_for << endl;
// else
// cout << "Flag2 : " << Flag2 << endl;
printf("ERR\n");
continue;
}
if (!Num_for && Max_complexity == Complexity)
printf("Yes\n");
if (!Num_for && Max_complexity != Complexity)
printf("No\n");
}
return 0;
}
/*
1
2 O(n^2)
F a 60 n
E
*/
QwQ