| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1285456 | lyra_g13 | Experimental Charges (NOI19_charges) | C++20 | 15 ms | 1276 KiB |
#include <bits/stdc++.h>
using ll = long long;
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n , q;
std::cin >> n >> q;
std::vector<ll> arr(n);
while(q--){
char cha;
ll a , b;
std::cin >> cha >> a >> b;
--a;
--b;
if(cha == 'Q'){
if(arr[a] == 1 and arr[b] == 1 ){
std::cout << "R\n";
}
else if(arr[a] == 1 and arr[b] == -1 ){
std::cout << "A\n";
}
else if(arr[a] == -1 and arr[b] == -1 ){
std::cout << "?\n";
}
else if(arr[a] == 0 and arr[b] == 0 ){
std::cout << "?\n";
}
else if(arr[a] != 0 and arr[b] == 0 ){
std::cout << "?\n";
}
else if(arr[a] == 0 and arr[b] != 0 ){
std::cout << "?\n";
}
}
else if( cha == 'A'){
if(arr[a] == 0 and arr[b] == 0 ){
arr[a] = 1;
arr[b] = -1;
}
else if(arr[a] != 0 and arr[b] == 0 ){
arr[b] = -1*arr[a];
}
else if(arr[a] == 0 and arr[b] != 0 ){
arr[a] = -1*arr[b];
}
}
else{
arr[b] = arr[a];
arr[a] = arr[b];
if(arr[a] == 0){
arr[a] = 1;
arr[b] = 1;
}
}
}
}
| # | 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... | ||||
