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

Submission #3731178

Source codeソースコード

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int n;

int main() {
  string ss; getline(cin, ss);
  vector<string> s;
  string t = "";
  for(int i=0; i<ss.size(); i++){
    if(ss[i] == ' '){
      s.push_back(t);
      t = "";
    }else{
      t += ss[i];
    }
  }
  s.push_back(t);
  n = s.size();
  s.push_back("not");
  s.push_back("not");
  vector<bool> a(n, true);
  for(int i=0; i<n; i++){
    if(s[i] == "not" && s[i+1] == "not" && s[i+2] == "not") continue;
    if(s[i] == "not" && s[i+1] == "not" && s[i+2] != "not"){
      a[i] = false;
      a[i+1] = false;
      i++;
    }
  }
  string ans = "";
  for(int i=0; i<n; i++){
    if(a[i]) ans += s[i] + ' ';
  }
  cout << ans.substr(0, ans.size()-1) << endl;

  return 0;
}




///

Submission

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

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 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 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 WA
scrambled_06.txt AC 2 ms 384 KB
scrambled_07.txt WA
scrambled_08.txt WA
scrambled_09.txt AC 2 ms 256 KB
scrambled_10.txt AC 2 ms 256 KB
scrambled_11.txt AC 2 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 2 ms 256 KB
scrambled_17.txt AC 2 ms 256 KB
scrambled_18.txt AC 2 ms 256 KB