JAG Contest 2016 Domestic

Submission #1501888

Source codeソースコード

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  int n;
  cin >> n;

  stack<string> st;
  bool wrong = false; // 初期値はtrueなことがある

  string s;
  rep (i, n) {
    cin >> s;
    if (s == "A") {
      st.push(s);
    }
    else if (s == "Un") {
      if (st.top() == "A") {
        st.pop();
      }
      else {
        wrong = true;
      }
    }
  }

  if (wrong || st.size() > 0) {
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }

  return 0;
}

Submission

Task問題 A - 阿吽の呼吸
User nameユーザ名 himkt
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 616 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 00_sample_00,00_sample_01,00_sample_02,00_sample_03,01_random_00,01_random_01,01_random_02,01_random_03,01_random_04,01_random_05,01_random_06,01_random_07,01_random_08,01_random_09,02_valid_00,02_valid_01,02_valid_02,02_valid_03,02_valid_04,02_valid_05,02_valid_06,02_valid_07,02_valid_08,02_valid_09,03_random_maximum_00,03_random_maximum_01,03_random_maximum_02,03_random_maximum_03,03_random_maximum_04,03_random_maximum_05,03_random_maximum_06,03_random_maximum_07,03_random_maximum_08,03_random_maximum_09,04_valid_maximum_00,04_valid_maximum_01,04_valid_maximum_02,04_valid_maximum_03,04_valid_maximum_04,04_valid_maximum_05,04_valid_maximum_06,04_valid_maximum_07,04_valid_maximum_08,04_valid_maximum_09

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_00 AC 1 ms 256 KB
00_sample_01 AC 1 ms 256 KB
00_sample_02 RE
00_sample_03 RE
01_random_00 RE
01_random_01 RE
01_random_02 AC 1 ms 256 KB
01_random_03 RE
01_random_04 RE
01_random_05 RE
01_random_06 RE
01_random_07 RE
01_random_08 RE
01_random_09 AC 1 ms 256 KB
02_valid_00 AC 1 ms 256 KB
02_valid_01 AC 1 ms 256 KB
02_valid_02 AC 1 ms 256 KB
02_valid_03 AC 1 ms 256 KB
02_valid_04 AC 1 ms 256 KB
02_valid_05 AC 1 ms 256 KB
02_valid_06 AC 1 ms 256 KB
02_valid_07 AC 1 ms 256 KB
02_valid_08 AC 1 ms 256 KB
02_valid_09 AC 1 ms 256 KB
03_random_maximum_00 RE
03_random_maximum_01 AC 1 ms 256 KB
03_random_maximum_02 RE
03_random_maximum_03 RE
03_random_maximum_04 RE
03_random_maximum_05 RE
03_random_maximum_06 RE
03_random_maximum_07 RE
03_random_maximum_08 RE
03_random_maximum_09 RE
04_valid_maximum_00 AC 1 ms 256 KB
04_valid_maximum_01 AC 1 ms 256 KB
04_valid_maximum_02 AC 1 ms 256 KB
04_valid_maximum_03 AC 1 ms 256 KB
04_valid_maximum_04 AC 1 ms 256 KB
04_valid_maximum_05 AC 1 ms 256 KB
04_valid_maximum_06 AC 1 ms 256 KB
04_valid_maximum_07 AC 1 ms 256 KB
04_valid_maximum_08 AC 1 ms 256 KB
04_valid_maximum_09 AC 1 ms 256 KB