Submission #47797

#TimeUsernameProblemLanguageResultExecution timeMemory
47797mirbek01Security Gate (JOI18_security_gate)C++17
0 / 100
2 ms376 KiB
# include <bits/stdc++.h> using namespace std; int n, ans, a[200], b[200], p[200]; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...