답안 #518277

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
518277 2022-01-23T10:08:28 Z brayden04 Experimental Charges (NOI19_charges) C++14
18 / 100
98 ms 6108 KB
#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

int N, Q;
map<int, int> charges;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);

  cin >> N >> Q;

  for (int i = 0; i < Q; i++){
    string T = "";
    int A = 0;
    int B = 0;
    cin >> T >> A >> B;

    if (T == "A"){
      if (charges[A] == 0 && charges[B] == 0){
        charges[A] = 1;
        charges[B] = -1;
      }
      else if (charges[A] == 1){
        charges[B] = -1;
      }
      else if (charges[A] == -1){
        charges[B] = 1;
      }
      else if (charges[B] == -1){
        charges[A] = 1;
      }
      else if (charges[B] == 1){
        charges[A] = -1;
      }
    }
    else if (T == "R"){
      if (charges[A] == 0 && charges[B] == 0){
        charges[A] = 1;
        charges[B] = 1;
      }
      else if (charges[A] == 1){
        charges[B] = 1;
      }
      else if (charges[A] == -1){
        charges[B] = -1;
      }
      else if (charges[B] == -1){
        charges[A] = -1;
      }
      else if (charges[B] == 1){
        charges[A] = 1;
      }
    }
    else if (T == "Q"){
      if (charges[A] == 0 || charges[B] == 0){
        cout << "?" << endl;
      }
      else if (charges[A] == charges[B]){
        cout << "R" << endl;
      }
      else{
        cout << "A" << endl;
      }
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 4756 KB Output is correct
2 Correct 55 ms 5036 KB Output is correct
3 Correct 61 ms 4412 KB Output is correct
4 Correct 57 ms 4936 KB Output is correct
5 Correct 52 ms 5064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 5728 KB Output is correct
2 Correct 96 ms 5116 KB Output is correct
3 Incorrect 98 ms 6108 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 5480 KB Output is correct
2 Correct 84 ms 5044 KB Output is correct
3 Incorrect 78 ms 5828 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 64 ms 4756 KB Output is correct
7 Correct 55 ms 5036 KB Output is correct
8 Correct 61 ms 4412 KB Output is correct
9 Correct 57 ms 4936 KB Output is correct
10 Correct 52 ms 5064 KB Output is correct
11 Correct 66 ms 5728 KB Output is correct
12 Correct 96 ms 5116 KB Output is correct
13 Incorrect 98 ms 6108 KB Output isn't correct
14 Halted 0 ms 0 KB -