//chockolateman
#include<bits/stdc++.h>
using namespace std;
int in_deegree[100005][10],positions[10];
vector<int> children[100005];
bool removed[100005][10];
int solve(int N, int M, std::vector<int> F,std::vector<std::vector<int>> S)
{
for(int i = 1 ; i < N ; i++)
for(int j = 0 ; j < M ; j++)
in_deegree[F[i]][j]++;
int counter = 0;
while(positions[0] != N-1)
{
counter++;
stack<int> removal_list;
for(int i = 0 ; i < M ; i++)
removal_list.push(S[i][positions[i]]);
while(!removal_list.empty())
{
int v = removal_list.top();
removal_list.pop();
for(int i = 0 ; i < M ; i++)
if(!removed[v][i])
{
while(S[i][positions[i]] != v)
{
removed[S[i][positions[i]]][i] = true;
removal_list.push(S[i][positions[i]++]);
}
positions[i]++;
removed[v][i] = true;
in_deegree[F[v]][i]--;
if(in_deegree[v][i]==0)
continue;
for(auto u : children[v])
{
if(removed[u][i])
continue;
in_deegree[v][i]--;
removal_list.push(u);
}
}
}
}
return counter;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1020 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1020 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1020 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1020 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |