답안 #772665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
772665 2023-07-04T10:09:26 Z Valters07 Homework (CEOI22_homework) C++14
10 / 100
1000 ms 13860 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> a;
string str;
int it;
int go(int l, int r)
{
    if(l==r)
        return a[it++];
    int op = 0, pos = l+4;
    while(1)
    {
        if(str[pos]=='(')
            op++;
        else if(str[pos]==')')
            op--;
        else if(str[pos]==','&&op==0)
            break;
        pos++;
    }
    int l1 = go(l+4,pos-1), r1 = go(pos+1,r-1);
    return ((str[l+1]=='i')?min(l1,r1):max(l1,r1));
}
int main()
{
    fio
//    ifstream cin("in.in");
    cin >> str;
    int n = 0;
    for(auto x:str)
        n+=(x=='?');
    a.resize(n);
    iota(a.begin(),a.end(),1);
    set<int> ans;
    do
    {
        it=0;
        ans.insert(go(0,str.size()-1));
    }
    while(next_permutation(a.begin(),a.end()));
    cout << ans.size();
//    cout << endl;for(auto x:ans)cout << x << " ";
//    cin.close();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 212 KB Output is correct
2 Correct 50 ms 300 KB Output is correct
3 Correct 50 ms 304 KB Output is correct
4 Correct 40 ms 212 KB Output is correct
5 Correct 45 ms 320 KB Output is correct
6 Correct 55 ms 212 KB Output is correct
7 Correct 50 ms 308 KB Output is correct
8 Correct 60 ms 212 KB Output is correct
9 Correct 39 ms 212 KB Output is correct
10 Correct 63 ms 304 KB Output is correct
11 Correct 36 ms 212 KB Output is correct
12 Correct 49 ms 212 KB Output is correct
13 Correct 43 ms 212 KB Output is correct
14 Correct 53 ms 304 KB Output is correct
15 Correct 48 ms 308 KB Output is correct
16 Correct 69 ms 212 KB Output is correct
17 Correct 54 ms 308 KB Output is correct
18 Correct 62 ms 304 KB Output is correct
19 Correct 63 ms 212 KB Output is correct
20 Correct 92 ms 212 KB Output is correct
21 Correct 55 ms 212 KB Output is correct
22 Correct 47 ms 304 KB Output is correct
23 Correct 40 ms 212 KB Output is correct
24 Correct 57 ms 212 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 5 ms 320 KB Output is correct
27 Correct 5 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 212 KB Output is correct
2 Correct 50 ms 300 KB Output is correct
3 Correct 50 ms 304 KB Output is correct
4 Correct 40 ms 212 KB Output is correct
5 Correct 45 ms 320 KB Output is correct
6 Correct 55 ms 212 KB Output is correct
7 Correct 50 ms 308 KB Output is correct
8 Correct 60 ms 212 KB Output is correct
9 Correct 39 ms 212 KB Output is correct
10 Correct 63 ms 304 KB Output is correct
11 Correct 36 ms 212 KB Output is correct
12 Correct 49 ms 212 KB Output is correct
13 Correct 43 ms 212 KB Output is correct
14 Correct 53 ms 304 KB Output is correct
15 Correct 48 ms 308 KB Output is correct
16 Correct 69 ms 212 KB Output is correct
17 Correct 54 ms 308 KB Output is correct
18 Correct 62 ms 304 KB Output is correct
19 Correct 63 ms 212 KB Output is correct
20 Correct 92 ms 212 KB Output is correct
21 Correct 55 ms 212 KB Output is correct
22 Correct 47 ms 304 KB Output is correct
23 Correct 40 ms 212 KB Output is correct
24 Correct 57 ms 212 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 5 ms 320 KB Output is correct
27 Correct 5 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Execution timed out 1068 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1012 ms 13860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 212 KB Output is correct
2 Correct 50 ms 300 KB Output is correct
3 Correct 50 ms 304 KB Output is correct
4 Correct 40 ms 212 KB Output is correct
5 Correct 45 ms 320 KB Output is correct
6 Correct 55 ms 212 KB Output is correct
7 Correct 50 ms 308 KB Output is correct
8 Correct 60 ms 212 KB Output is correct
9 Correct 39 ms 212 KB Output is correct
10 Correct 63 ms 304 KB Output is correct
11 Correct 36 ms 212 KB Output is correct
12 Correct 49 ms 212 KB Output is correct
13 Correct 43 ms 212 KB Output is correct
14 Correct 53 ms 304 KB Output is correct
15 Correct 48 ms 308 KB Output is correct
16 Correct 69 ms 212 KB Output is correct
17 Correct 54 ms 308 KB Output is correct
18 Correct 62 ms 304 KB Output is correct
19 Correct 63 ms 212 KB Output is correct
20 Correct 92 ms 212 KB Output is correct
21 Correct 55 ms 212 KB Output is correct
22 Correct 47 ms 304 KB Output is correct
23 Correct 40 ms 212 KB Output is correct
24 Correct 57 ms 212 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 5 ms 320 KB Output is correct
27 Correct 5 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Execution timed out 1068 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 212 KB Output is correct
2 Correct 50 ms 300 KB Output is correct
3 Correct 50 ms 304 KB Output is correct
4 Correct 40 ms 212 KB Output is correct
5 Correct 45 ms 320 KB Output is correct
6 Correct 55 ms 212 KB Output is correct
7 Correct 50 ms 308 KB Output is correct
8 Correct 60 ms 212 KB Output is correct
9 Correct 39 ms 212 KB Output is correct
10 Correct 63 ms 304 KB Output is correct
11 Correct 36 ms 212 KB Output is correct
12 Correct 49 ms 212 KB Output is correct
13 Correct 43 ms 212 KB Output is correct
14 Correct 53 ms 304 KB Output is correct
15 Correct 48 ms 308 KB Output is correct
16 Correct 69 ms 212 KB Output is correct
17 Correct 54 ms 308 KB Output is correct
18 Correct 62 ms 304 KB Output is correct
19 Correct 63 ms 212 KB Output is correct
20 Correct 92 ms 212 KB Output is correct
21 Correct 55 ms 212 KB Output is correct
22 Correct 47 ms 304 KB Output is correct
23 Correct 40 ms 212 KB Output is correct
24 Correct 57 ms 212 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 5 ms 320 KB Output is correct
27 Correct 5 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Execution timed out 1068 ms 212 KB Time limit exceeded
30 Halted 0 ms 0 KB -