# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
263538 | T0p_ | Experimental Charges (NOI19_charges) | C++14 | 50 ms | 3072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int pa[200200];
int fp(int node)
{
return (node == pa[node]) ? node : pa[node] = fp(pa[node]);
}
int main()
{
int n, q;
scanf(" %d %d",&n,&q);
for(int i=1 ; i<=n+n ; i++)
pa[i] = i;
while(q--)
{
char c;
int a, b;
scanf(" %c %d %d",&c,&a,&b);
if(c == 'A')
{
pa[fp(a)] = fp(b+n);
pa[fp(a+n)] = fp(b);
}
else if(c == 'R')
{
pa[fp(a)] = fp(b);
pa[fp(a+n)] = fp(b+n);
}
else
{
if(fp(a) == fp(b+n)) printf("A\n");
else if(fp(a) == fp(b)) printf("R\n");
else printf("?\n");
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |