Submission #371324


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it,o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

int main(){
    string s;
    vector<pair<string, int> > V;
    while(cin >> s){
        if(s == "not"){
            if(V.empty() || V.back().second == 0){
                V.push_back(make_pair("", 1));
            }
            else{
                V.back().second++;
            }
        }
        else{
            V.push_back(make_pair(s, 0));
        }
    }
    bool is_first = true;
    rep(i, V.size()){
        if(V[i].second == 0){
            if(!is_first)cout <<' ';
            cout << V[i].first;
            is_first = false;
        }else{
            if(i+1 < V.size()){
                V[i].second %= 2;
            }
            rep(j, V[i].second){
                if(j != 0 || !is_first)cout <<' ';
                is_first = false;
                cout << "not";
            }
        }
    }
    cout << endl;
return 0;
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User mushipan
Language C++ (GCC 4.9.2)
Score 100
Code Size 1644 Byte
Status AC
Exec Time 26 ms
Memory 932 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 24 ms 796 KB
scrambled_01.txt AC 23 ms 924 KB
scrambled_02.txt AC 25 ms 804 KB
scrambled_03.txt AC 25 ms 924 KB
scrambled_04.txt AC 24 ms 924 KB
scrambled_05.txt AC 26 ms 808 KB
scrambled_06.txt AC 26 ms 924 KB
scrambled_07.txt AC 26 ms 924 KB
scrambled_08.txt AC 26 ms 812 KB
scrambled_09.txt AC 26 ms 800 KB
scrambled_10.txt AC 26 ms 924 KB
scrambled_11.txt AC 25 ms 924 KB
scrambled_12.txt AC 26 ms 808 KB
scrambled_13.txt AC 25 ms 804 KB
scrambled_14.txt AC 26 ms 804 KB
scrambled_15.txt AC 26 ms 932 KB
scrambled_16.txt AC 26 ms 928 KB
scrambled_17.txt AC 24 ms 928 KB
scrambled_18.txt AC 26 ms 928 KB