# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
73739 | TadijaSebez | Security Gate (JOI18_security_gate) | C++11 | 5020 ms | 848 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=105;
char s[N];
int n;
bool good(int l, int r)
{
int c=0;
for(int i=0;i<n;i++)
{
if(l<=i && i<=r)
{
if(s[i]==')') c++;
else c--;
}
else
{
if(s[i]=='(') c++;
else c--;
}
if(c<0) return 0;
}
return c==0;
}
bool Check()
{
for(int i=0;i<n;i++) for(int j=i;j<n;j++) if(good(i,j)) return 1;
if(good(0,-1)) return 1;
return 0;
}
int main()
{
int i,j,k=0;
scanf("%i",&n);
scanf("%s",s);
vector<int> pos;
for(i=0;i<n;i++) if(s[i]=='x') pos.pb(i),k++;
int sol=0;
if(k>20) return printf("0\n"),0;
for(j=0;j<1<<k;j++)
{
for(i=0;i<k;i++) s[pos[i]]='('+((j>>i)&1);
//cout << s << endl;
if(Check()) sol++;
}
printf("%i\n",sol);
return 0;
}
컴파일 시 표준 에러 (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... |