Submission #47798

# Submission time Handle Problem Language Result Execution time Memory
47798 2018-05-07T10:14:07 Z mirbek01 Security Gate (JOI18_security_gate) C++14
0 / 100
2 ms 376 KB
# include <bits/stdc++.h>

using namespace std;

int n, ans;
string s;
vector <int> v;

int main(){
      cin >> n >> s;

      for(int i = 0; i < n; i ++)
            if(s[i] == 'x')
                  v.push_back(i);

      int sz = v.size();

      for(int mask = 0; mask < (1 << sz); mask ++){
            for(int i = 0; i < sz; i ++){
                  int bit = (1 << i) & mask;
                  if(bit)
                        s[v[i]] = ')';
                  else
                        s[v[i]] = '(';
            }

            bool f = 0;

            for(int i = 0; i < n && !f; i ++){
                  for(int j = i; j < n && !f; j ++){
                        int sum = 0;
                        bool ff = 1;
                        for(int k = 0; k < n && ff; k ++){
                              if(((i > k || k > j) && s[k] == '(') || (i <= k && k <= j && s[k] == ')'))
                                    sum ++;
                              else
                                    sum --;
                              if(sum < 0) ff = 0;
                        }
                        if(sum != 0) ff = 0;
                        f |= ff;
                  }
            }
            ans += f;
      }

      cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -