# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
537560 | 2022-03-15T08:32:21 Z | jamezzz | Security Gate (JOI18_security_gate) | C++17 | 5000 ms | 300 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf int n,x,pos[25]; char s[105]; int main(){ sf("%d",&n); assert(n<=100); sf(" %s",&s); for(int i=0;i<n;++i){ if(s[i]=='x'){ pos[x]=i; ++x; } } assert(x<=20); int ans=0; for(int i=0;i<(1<<x);++i){ for(int j=0;j<x;++j){ if(i&(1<<j))s[pos[j]]=')'; else s[pos[j]]='('; } bool val=false; for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ int cnt=0;bool pos=true; for(int k=0;k<n;++k){ int mult=1; if(i<=k&&k<=j)mult=-1; if(s[k]=='(')cnt+=mult; else cnt-=mult; if(cnt<0){ pos=false; break; } } if(cnt!=0)pos=false; if(pos){ val=true; break; } } if(val)break; } if(val)++ans; } pf("%d\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 7 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 7 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 23 ms | 296 KB | Output is correct |
20 | Correct | 13 ms | 300 KB | Output is correct |
21 | Correct | 1570 ms | 272 KB | Output is correct |
22 | Correct | 1195 ms | 280 KB | Output is correct |
23 | Correct | 20 ms | 296 KB | Output is correct |
24 | Correct | 1197 ms | 276 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 13 ms | 296 KB | Output is correct |
27 | Correct | 1349 ms | 284 KB | Output is correct |
28 | Correct | 45 ms | 212 KB | Output is correct |
29 | Correct | 6 ms | 296 KB | Output is correct |
30 | Correct | 24 ms | 296 KB | Output is correct |
31 | Correct | 132 ms | 276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 7 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 23 ms | 296 KB | Output is correct |
20 | Correct | 13 ms | 300 KB | Output is correct |
21 | Correct | 1570 ms | 272 KB | Output is correct |
22 | Correct | 1195 ms | 280 KB | Output is correct |
23 | Correct | 20 ms | 296 KB | Output is correct |
24 | Correct | 1197 ms | 276 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 13 ms | 296 KB | Output is correct |
27 | Correct | 1349 ms | 284 KB | Output is correct |
28 | Correct | 45 ms | 212 KB | Output is correct |
29 | Correct | 6 ms | 296 KB | Output is correct |
30 | Correct | 24 ms | 296 KB | Output is correct |
31 | Correct | 132 ms | 276 KB | Output is correct |
32 | Correct | 238 ms | 288 KB | Output is correct |
33 | Correct | 78 ms | 212 KB | Output is correct |
34 | Execution timed out | 5092 ms | 212 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 7 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 23 ms | 296 KB | Output is correct |
20 | Correct | 13 ms | 300 KB | Output is correct |
21 | Correct | 1570 ms | 272 KB | Output is correct |
22 | Correct | 1195 ms | 280 KB | Output is correct |
23 | Correct | 20 ms | 296 KB | Output is correct |
24 | Correct | 1197 ms | 276 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 13 ms | 296 KB | Output is correct |
27 | Correct | 1349 ms | 284 KB | Output is correct |
28 | Correct | 45 ms | 212 KB | Output is correct |
29 | Correct | 6 ms | 296 KB | Output is correct |
30 | Correct | 24 ms | 296 KB | Output is correct |
31 | Correct | 132 ms | 276 KB | Output is correct |
32 | Correct | 238 ms | 288 KB | Output is correct |
33 | Correct | 78 ms | 212 KB | Output is correct |
34 | Execution timed out | 5092 ms | 212 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 7 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 23 ms | 296 KB | Output is correct |
20 | Correct | 13 ms | 300 KB | Output is correct |
21 | Correct | 1570 ms | 272 KB | Output is correct |
22 | Correct | 1195 ms | 280 KB | Output is correct |
23 | Correct | 20 ms | 296 KB | Output is correct |
24 | Correct | 1197 ms | 276 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 13 ms | 296 KB | Output is correct |
27 | Correct | 1349 ms | 284 KB | Output is correct |
28 | Correct | 45 ms | 212 KB | Output is correct |
29 | Correct | 6 ms | 296 KB | Output is correct |
30 | Correct | 24 ms | 296 KB | Output is correct |
31 | Correct | 132 ms | 276 KB | Output is correct |
32 | Correct | 238 ms | 288 KB | Output is correct |
33 | Correct | 78 ms | 212 KB | Output is correct |
34 | Execution timed out | 5092 ms | 212 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |