답안 #518286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
518286 2022-01-23T10:21:51 Z brayden04 Experimental Charges (NOI19_charges) C++14
18 / 100
88 ms 4888 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] == 0){
        charges[B] = 1;
      }
      else if (charges[A] == -1 && charges[B] == 0){
        charges[B] = -1;
      }
      else if (charges[B] == -1 && charges[A] == 0){
        charges[A] = -1;
      }
      else if (charges[B] == 1 && charges[A] == 0){
        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 if ((charges[A] != 0) && (charges[B] != 0) && (charges[A] != charges[B])){
        cout << "A" << endl;
      }
    }
  }

  //cout << "----------------" << endl;

  //for (int i = 1; i <= N; i++){
    //cout << charges[i] << endl;
  //}
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 3836 KB Output is correct
2 Correct 60 ms 4052 KB Output is correct
3 Correct 60 ms 3400 KB Output is correct
4 Correct 62 ms 4100 KB Output is correct
5 Correct 59 ms 4208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4372 KB Output is correct
2 Correct 79 ms 3852 KB Output is correct
3 Incorrect 81 ms 4888 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 4248 KB Output is correct
2 Correct 87 ms 3764 KB Output is correct
3 Incorrect 88 ms 4464 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Incorrect 2 ms 332 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 68 ms 3836 KB Output is correct
7 Correct 60 ms 4052 KB Output is correct
8 Correct 60 ms 3400 KB Output is correct
9 Correct 62 ms 4100 KB Output is correct
10 Correct 59 ms 4208 KB Output is correct
11 Correct 72 ms 4372 KB Output is correct
12 Correct 79 ms 3852 KB Output is correct
13 Incorrect 81 ms 4888 KB Output isn't correct
14 Halted 0 ms 0 KB -