| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 407116 | 79brue | Security Gate (JOI18_security_gate) | C++14 | 1 ms | 204 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
char s[102];
int pref[102];
int ans;
void dfs(int x){
    if(x == n+1){
        int firstNegative = 101, lastNegative = -1;
        for(int i=1; i<=n; i++) if(pref[i] < 0) firstNegative = min(firstNegative, i);
        for(int i=1; i<=n; i++) if(pref[i] - pref[n] < 0) lastNegative = i;
        bool able = 0;
        for(int i=1; i<=n && i<=firstNegative; i++){
            bool good = 0;
            for(int j=i; j<=n; j++){
                if(pref[j] > 2 * pref[i-1]) break;
                if(pref[n] - 2 * (pref[j] - pref[i-1]) == 0 && j > lastNegative){
                    good = 1;
                    break;
                }
            }
            if(good){
                able = 1;
                break;
            }
        }
        if(able) ans++;
        return;
    }
    if(s[x] == '(' || s[x] == ')'){
        pref[x] = pref[x-1] + (s[x] == '(' ? 1 : -1);
        dfs(x+1);
        return;
    }
    s[x] = '('; pref[x] = pref[x-1] + 1;
    dfs(x+1);
    s[x] = ')'; pref[x] = pref[x-1] - 1;
    dfs(x+1);
    s[x] = 'x';
    return;
}
int main(){
    scanf("%d %s", &n, s+1);
    if(n%2){
        printf("0");
        return 0;
    }
    dfs(1);
    printf("%d", ans);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
