이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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(auto [x, y] : v)
for(int z = 1; z <= N; z++)
if(adj[y][z] && adj[z][y] && x != z && adj[x][z] == 0)
{
adj[x][z] = 2;
v.emplace_back(pii(x, z));
}
cout << v.size() << '\n';
v.resize(i);
for(int x = 1; x <= N; x++)
for(int y = 1; y <= N; y++)
{
ans += adj[x][y] > 0;
if(adj[x][y] == 2)
adj[x][y] = 0;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
joitter2.cpp: In function 'int main()':
joitter2.cpp:24:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
24 | for(auto [x, y] : v)
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |