Submission #371350


Source Code Expand

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
    vector<string> ss;
	string s;
    while(cin >> s) ss.push_back(s);
    
    if(ss.size() <= 2){
        REP(i, ss.size()){
            if(!i) cout << ss[i];
            else cout << " " << ss[i];
        }
        cout << endl;
        return 0;
    }
    bool f = true;
    while(f){
        f = false;
        vector<string> sss;
        int i = 0;
        if(ss.size() <= 2) break;
        for(;i < ss.size() - 2;i++){
            if(ss[i] == "not" && ss[i+1] == "not" && ss[i+2] != "not"){
                f = true;
                sss.push_back(ss[i + 2]);
                i += 2;
            }
            else sss.push_back(ss[i]);
        }
        for(; i < ss.size(); i++) sss.push_back(ss[i]);
        ss = sss;
    }
    for(int i = 0; i < ss.size(); i++){
        if(!i) cout << ss[i];
        else cout << " " << ss[i];
    }
    cout << endl;
    return 0;
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User itf
Language C++ (GCC 4.9.2)
Score 100
Code Size 1635 Byte
Status AC
Exec Time 70 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 28 ms 796 KiB
scrambled_01.txt AC 27 ms 808 KiB
scrambled_02.txt AC 24 ms 920 KiB
scrambled_03.txt AC 27 ms 760 KiB
scrambled_04.txt AC 25 ms 920 KiB
scrambled_05.txt AC 70 ms 912 KiB
scrambled_06.txt AC 24 ms 924 KiB
scrambled_07.txt AC 65 ms 924 KiB
scrambled_08.txt AC 65 ms 924 KiB
scrambled_09.txt AC 25 ms 728 KiB
scrambled_10.txt AC 25 ms 920 KiB
scrambled_11.txt AC 25 ms 920 KiB
scrambled_12.txt AC 25 ms 920 KiB
scrambled_13.txt AC 23 ms 808 KiB
scrambled_14.txt AC 23 ms 808 KiB
scrambled_15.txt AC 25 ms 928 KiB
scrambled_16.txt AC 27 ms 804 KiB
scrambled_17.txt AC 24 ms 924 KiB
scrambled_18.txt AC 25 ms 928 KiB