Submission #371223


Source Code Expand

#include <bits/stdc++.h>

#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;

string s[5000];

int main() {
    int n = 0;
    while (cin >> s[n]) {
        n++;
    }
    string ans;
    for (int i = 0; i < n; i++) {
        // 文字列がnotの場合
        if (s[i] == "not") {
            int cnt = 0;
            int cur = i;
            while (s[cur] == "not" && cur < n) {
                cur++;
                cnt++;
            }
            if (cur != n) {
                for (int j = 0; j < cnt%2; j++) {
                    ans += "not ";
                }
            } else {
                for (int j = i; j < n; j++) {
                    if (j != n-1) ans += "not ";
                    else ans += "not";
                }
            }
            i = cur-1;
        } else {
            if (i != n-1) {
                ans += s[i];
                ans += " ";
            }
            else ans += s[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User mayohara
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1150 Byte
Status AC
Exec Time 29 ms
Memory 928 KiB

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 24 ms 928 KiB
scrambled_01.txt AC 24 ms 804 KiB
scrambled_02.txt AC 25 ms 928 KiB
scrambled_03.txt AC 25 ms 804 KiB
scrambled_04.txt AC 24 ms 928 KiB
scrambled_05.txt AC 28 ms 928 KiB
scrambled_06.txt AC 27 ms 916 KiB
scrambled_07.txt AC 25 ms 804 KiB
scrambled_08.txt AC 25 ms 800 KiB
scrambled_09.txt AC 24 ms 924 KiB
scrambled_10.txt AC 25 ms 876 KiB
scrambled_11.txt AC 26 ms 924 KiB
scrambled_12.txt AC 29 ms 920 KiB
scrambled_13.txt AC 24 ms 920 KiB
scrambled_14.txt AC 25 ms 924 KiB
scrambled_15.txt AC 27 ms 860 KiB
scrambled_16.txt AC 27 ms 916 KiB
scrambled_17.txt AC 28 ms 916 KiB
scrambled_18.txt AC 27 ms 860 KiB