| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 209435 | model_code | Experimental Charges (NOI19_charges) | C++17 | 47 ms | 1660 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
pair<int,bool> p[100009];
pair<int,bool> fp(int x){
if(p[x].first==x)return make_pair(x, 0);
pair<int,bool> xpar = fp(p[x].first);
return p[x] = make_pair(xpar.first, xpar.second^p[x].second);
}
void mg(int x,int y,bool r){
pair<int,bool> xpar = fp(x), ypar = fp(y);
if (xpar.first == ypar.first) return;
p[xpar.first]= make_pair(ypar.first, r^xpar.second^ypar.second);
}
int main(){
int n,q;
scanf("%d%d",&n,&q);
for (int i = 0; i < n; i++) p[i] = make_pair(i, 0);
for (int i = 0; i < q; i++) {
char t;
int a,b;
scanf(" %c%d%d",&t,&a,&b);a--;b--;
if (t=='Q') {
pair<int,bool> apar = fp(a), bpar = fp(b);
if (apar.first !=bpar.first) puts("?");
else {
puts((apar.second != bpar.second)?"A":"R");
}
}
else mg(a,b,t=='A');
}
}
컴파일 시 표준 에러 (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... | ||||
