Submission #1338602


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  vector<string> vec;
  string t;
  int c=0;
  while(cin>>t){
    vec.pb(t);
    if(t=="not") c++;
  }

  vector<string> ans;
  int n = vec.size();

  if(c == vec.size()) ans = vec;
  else {
    int cnt = 0;
    rep(i,n){
      bool b = vec[i]=="not";
      if(cnt>0 && !b){
        rep(j,cnt%2) ans.pb("not");
      }
      if(b) cnt++;
      else {
        cnt = 0;
        ans.pb(vec[i]);
      }
    }
  }

  n  =ans.size();
  rep(i,n) cout << ans[i] << " \n"[i==n-1];

  return 0;
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User tossy
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1179 Byte
Status AC
Exec Time 2 ms
Memory 384 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 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 AC 2 ms 256 KB
scrambled_06.txt AC 2 ms 384 KB
scrambled_07.txt AC 2 ms 256 KB
scrambled_08.txt AC 2 ms 256 KB
scrambled_09.txt AC 1 ms 256 KB
scrambled_10.txt AC 1 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