#include <iostream>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
int follow[1+N][1+N];
for(int i = 1; i <= N; i++)
for(int j = 1; j <= N; j++)
follow[i][j] = 0;
int ans = 0;
for(int j = 1; j <= M; j++)
{
int a, b;
cin >> a >> b;
if(!follow[a][b]) ans++;
follow[a][b] = 1;
for(int q = 1; q <= N*N*N; q++)
{
for(int x = 1; x <= N; x++)
{
for(int y = 1; y <= N; y++)
{
for(int z = 1; z <= N; z++)
{
if(x == y || y == z || z == x) continue;
if(follow[x][y] && !follow[x][z] && follow[y][z] && follow[z][y])
{
ans++;
follow[x][z] = 1;
}
}
}
}
}
cout << ans << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
33 ms |
204 KB |
Output is correct |
5 |
Correct |
247 ms |
204 KB |
Output is correct |
6 |
Correct |
248 ms |
204 KB |
Output is correct |
7 |
Execution timed out |
5044 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
33 ms |
204 KB |
Output is correct |
5 |
Correct |
247 ms |
204 KB |
Output is correct |
6 |
Correct |
248 ms |
204 KB |
Output is correct |
7 |
Execution timed out |
5044 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
33 ms |
204 KB |
Output is correct |
5 |
Correct |
247 ms |
204 KB |
Output is correct |
6 |
Correct |
248 ms |
204 KB |
Output is correct |
7 |
Execution timed out |
5044 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |