東京大学プログラミングコンテスト2014

Submission #3422744

Source codeソースコード

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>

const int N = 10010;

std::string a, s[N], aim = "not";
int n;
bool vis[N];

int main() {
	//freopen("in.in", "r", stdin);
	//freopen("my.out", "w", stdout);
	
    while(std::cin >> a) {
        s[++n] = a;
    }
    int last;
    for(int i = n - 2; i >= 1; i--) { 
        if(!vis[i + 2]) {
            last = i + 2;
        }
        if(s[i] == aim && s[i + 1] == aim && s[last] != aim) {
            vis[i] = vis[i + 1] = 1;
            i--;
        }
    }
    int t = n;
    while(vis[t]) {
    	t--;
	}
    for(int i = 1; i <= n; i++) {
        if(!vis[i]) {
            std::cout << s[i];
            if(i != t) {
            	std::cout << " ";
			}
			else {
				std::cout << std::endl;
			}
        }
    }
    return 0;
}

Submission

Task問題 A - 二重否定除去法則
User nameユーザ名 huyufeifei
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 851 Byte
File nameファイル名
Exec time実行時間 2 ms
Memory usageメモリ使用量 384 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
scrambled_00.txt AC 1 ms 384 KB
scrambled_01.txt AC 1 ms 384 KB
scrambled_02.txt AC 1 ms 384 KB
scrambled_03.txt AC 1 ms 384 KB
scrambled_04.txt AC 1 ms 384 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 384 KB
scrambled_10.txt AC 1 ms 384 KB
scrambled_11.txt AC 1 ms 384 KB
scrambled_12.txt AC 2 ms 384 KB
scrambled_13.txt AC 1 ms 384 KB
scrambled_14.txt AC 1 ms 384 KB
scrambled_15.txt AC 2 ms 384 KB
scrambled_16.txt AC 2 ms 384 KB
scrambled_17.txt AC 2 ms 384 KB
scrambled_18.txt AC 2 ms 384 KB