Submission #1219663


Source Code Expand

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stack>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

vector<string> S;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  while (true) {
    string s;
    if (!(cin >> s)) break;
    S.pb(s);
  }
  stack<string> T;
  int i = S.size()-1;
  while (i>=0 && S[i] == "not") {
    T.push(S[i]);
    i--;
  }
  int c = 0;
  while (i>=0) {
    if (S[i] == "not") c++;
    else {
      c %= 2;
      rep(i, c) T.push("not");
      c = 0;
      T.push(S[i]);
    }
    i--;
  }
  c %= 2;
  rep(i, c) T.push("not");
  while (!T.empty()) {
    cout << T.top() << (T.size()==1?"\n":" ");
    T.pop();
  }
  return 0;
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User funcsr
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1078 Byte
Status AC
Exec Time 2 ms
Memory 384 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 19
Set Name Test Cases
All scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt
Case Name Status Exec Time Memory
scrambled_00.txt AC 1 ms 256 KB
scrambled_01.txt AC 1 ms 256 KB
scrambled_02.txt AC 1 ms 256 KB
scrambled_03.txt AC 1 ms 256 KB
scrambled_04.txt AC 1 ms 256 KB
scrambled_05.txt AC 2 ms 384 KB
scrambled_06.txt AC 2 ms 384 KB
scrambled_07.txt AC 2 ms 384 KB
scrambled_08.txt AC 2 ms 384 KB
scrambled_09.txt AC 1 ms 256 KB
scrambled_10.txt AC 1 ms 256 KB
scrambled_11.txt AC 1 ms 256 KB
scrambled_12.txt AC 2 ms 256 KB
scrambled_13.txt AC 2 ms 256 KB
scrambled_14.txt AC 2 ms 256 KB
scrambled_15.txt AC 2 ms 256 KB
scrambled_16.txt AC 1 ms 384 KB
scrambled_17.txt AC 1 ms 256 KB
scrambled_18.txt AC 2 ms 256 KB