Submission #568004

# Submission time Handle Problem Language Result Execution time Memory
568004 2022-05-24T13:36:33 Z LittleCube Making Friends on Joitter is Fun (JOI20_joitter2) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int N, M, adj[2005][2005];
vector<pii> v;

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> N >> M;
	
	for(int i = 1; i <= M; i++)
	{
		int A, B, ans = 0;
		cin >> A >> B;
		adj[A][B] = 1;
		v.emplace_back(pii(A, B));
		for(int j = 0; j < v.size(); j++)
		{
			auto [x, y] = v[j];
			assert(adj[x][y]);
			for(int z = 1; z <= N; z++)
				if(adj[y][z] && adj[z][y] && x != z && adj[x][z] == 0)
				{	
					adj[x][z] = 1;
					v.emplace_back(pii(x, z));
				}
		}
		cout << v.size() << '\n';
	}
}

Compilation message

joitter2.cpp: In function 'int main()':
joitter2.cpp:24:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int j = 0; j < v.size(); j++)
      |                  ~~^~~~~~~~~~
joitter2.cpp:20:13: warning: unused variable 'ans' [-Wunused-variable]
   20 |   int A, B, ans = 0;
      |             ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -