제출 #1285466

#제출 시각아이디문제언어결과실행 시간메모리
1285466lyra_g13Experimental Charges (NOI19_charges)C++20
18 / 100
13 ms1252 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);
    arr[0] = 1;
    while(q--){
        char t; 
        ll a , b;
        std::cin >> t >> a >>b;
        --a; 
        --b;
       if(t == '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 << "A\n";
            }
           else if(arr[a] == -1 and arr[b] == -1 ){
                std::cout << "R\n";
            }
           else if(arr[a] == 1 and arr[b] == 0 ){
                std::cout << "?\n";
            }
           else if(arr[a] == 0 and arr[b] == 1){
                std::cout << "?\n";
            }
       }
       else if(t == 'A'){
        if(arr[a] == 1){
            arr[b] = -1;
        }
        else{
            arr[a] = -1;
        }
    }
        if(t == 'R'){
         if(arr[a] == 1){
            arr[b] = 1;
        }
        else{
            arr[a] = 1;
        }
        }
       }
    }
   


    
    
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...