QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140481#4400. Homeworkscidroid10 35ms3588kbC++171.3kb2023-08-15 23:50:192023-08-15 23:50:20

Judging History

你现在查看的是最新测评结果

  • [2023-08-15 23:50:20]
  • 评测
  • 测评结果:10
  • 用时:35ms
  • 内存:3588kb
  • [2023-08-15 23:50:19]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define vll vector<ll>

ll check(string op, vll pr) {
    stack<ll> nums;

    for (ll i = op.size() - 1; i >= 0; --i) {
        if (op[i] == '?') {
            nums.push(pr[pr.size() - 1]);
            pr.pop_back();
        } else {
            ll val1 = nums.top();
            nums.pop();

            ll val2 = nums.top();
            nums.pop();

            if (op[i] == 'n') {
                nums.push(min(val1, val2));
            } else {
                nums.push(max(val1, val2));
            }
        }
    }

    return nums.top();
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string a; cin >> a;

    string aux = "";
    ll num = 0;

    for (ll i = 0; i < a.size(); ++i) {
        if (a[i] == 'x' || a[i] == 'n' || a[i] == '?') {
            aux.pb(a[i]);

            if (a[i] == '?') {
                ++num;
            }
        }
    }

    set<ll> answers;

    vll nums;

    for (ll i = 1; i <= num; ++i) {
        nums.pb(i);
    }

    do {
        answers.insert(check(aux, nums));
    } while (next_permutation(nums.begin(), nums.end()));

    cout << answers.size() << endl;

    return 0;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 34ms
memory: 3580kb

input:

min(max(?,max(min(?,min(?,?)),?)),min(max(?,?),max(?,?)))

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 33ms
memory: 3532kb

input:

max(max(?,min(max(?,min(?,?)),?)),max(max(?,?),max(?,?)))

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 33ms
memory: 3460kb

input:

min(min(min(?,min(?,?)),min(?,?)),min(?,min(min(?,?),?)))

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 33ms
memory: 3476kb

input:

max(max(max(?,?),?),max(max(?,?),min(max(?,?),max(?,?))))

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 31ms
memory: 3528kb

input:

min(max(?,min(?,?)),max(min(max(?,?),?),min(max(?,?),?)))

output:

6

result:

ok single line: '6'

Test #6:

score: 0
Accepted
time: 34ms
memory: 3460kb

input:

max(max(?,min(max(?,?),?)),max(max(max(?,?),min(?,?)),?))

output:

4

result:

ok single line: '4'

Test #7:

score: 0
Accepted
time: 35ms
memory: 3484kb

input:

min(min(max(min(?,?),?),?),min(?,max(max(?,?),min(?,?))))

output:

6

result:

ok single line: '6'

Test #8:

score: 0
Accepted
time: 34ms
memory: 3460kb

input:

min(min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?))),?)

output:

2

result:

ok single line: '2'

Test #9:

score: 0
Accepted
time: 33ms
memory: 3480kb

input:

max(max(?,?),max(max(max(?,?),max(?,?)),max(?,max(?,?))))

output:

1

result:

ok single line: '1'

Test #10:

score: 0
Accepted
time: 35ms
memory: 3532kb

input:

min(max(min(?,?),?),max(min(?,max(min(max(?,?),?),?)),?))

output:

7

result:

ok single line: '7'

Test #11:

score: 0
Accepted
time: 30ms
memory: 3528kb

input:

max(?,min(max(?,min(?,?)),max(max(?,?),min(?,max(?,?)))))

output:

7

result:

ok single line: '7'

Test #12:

score: 0
Accepted
time: 34ms
memory: 3484kb

input:

min(min(max(?,?),?),max(max(?,min(max(?,?),?)),max(?,?)))

output:

7

result:

ok single line: '7'

Test #13:

score: 0
Accepted
time: 33ms
memory: 3588kb

input:

min(min(min(?,?),min(?,max(?,?))),min(?,min(?,min(?,?))))

output:

2

result:

ok single line: '2'

Test #14:

score: 0
Accepted
time: 34ms
memory: 3588kb

input:

min(max(max(?,?),max(?,max(max(?,?),max(?,?)))),max(?,?))

output:

7

result:

ok single line: '7'

Test #15:

score: 0
Accepted
time: 35ms
memory: 3480kb

input:

max(min(?,?),min(max(min(?,?),min(?,max(?,min(?,?)))),?))

output:

7

result:

ok single line: '7'

Test #16:

score: 0
Accepted
time: 34ms
memory: 3476kb

input:

min(?,min(?,max(max(max(min(?,min(min(?,?),?)),?),?),?)))

output:

7

result:

ok single line: '7'

Test #17:

score: 0
Accepted
time: 34ms
memory: 3476kb

input:

min(?,min(?,max(?,max(min(min(min(?,min(?,?)),?),?),?))))

output:

7

result:

ok single line: '7'

Test #18:

score: 0
Accepted
time: 29ms
memory: 3572kb

input:

min(?,min(min(min(?,min(?,min(?,min(min(?,?),?)))),?),?))

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 33ms
memory: 3472kb

input:

max(max(max(?,max(?,max(?,max(?,max(max(?,?),?))))),?),?)

output:

1

result:

ok single line: '1'

Test #20:

score: 0
Accepted
time: 32ms
memory: 3472kb

input:

min(max(?,min(max(min(max(min(?,max(?,?)),?),?),?),?)),?)

output:

8

result:

ok single line: '8'

Test #21:

score: 0
Accepted
time: 33ms
memory: 3588kb

input:

min(min(?,?),min(min(min(?,?),min(min(?,min(?,?)),?)),?))

output:

1

result:

ok single line: '1'

Test #22:

score: 0
Accepted
time: 32ms
memory: 3476kb

input:

max(max(max(?,?),max(max(?,?),?)),max(max(?,?),max(?,?)))

output:

1

result:

ok single line: '1'

Test #23:

score: 0
Accepted
time: 33ms
memory: 3532kb

input:

min(max(?,min(max(?,?),?)),min(?,min(?,min(?,max(?,?)))))

output:

5

result:

ok single line: '5'

Test #24:

score: 0
Accepted
time: 29ms
memory: 3456kb

input:

min(?,max(min(min(max(?,?),?),max(?,?)),min(min(?,?),?)))

output:

6

result:

ok single line: '6'

Test #25:

score: 0
Accepted
time: 4ms
memory: 3472kb

input:

min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?)))

output:

2

result:

ok single line: '2'

Test #26:

score: 0
Accepted
time: 4ms
memory: 3580kb

input:

min(min(min(?,?),min(?,?)),min(min(?,?),min(?,?)))

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 4ms
memory: 3520kb

input:

max(min(max(?,?),max(?,?)),min(max(?,?),max(?,?)))

output:

4

result:

ok single line: '4'

Test #28:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

max(?,?)

output:

1

result:

ok single line: '1'

Subtask #2:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #29:

score: 0
Time Limit Exceeded

input:

min(max(min(?,max(?,max(?,?))),min(min(?,min(?,?)),?)),min(max(?,max(?,?)),min(min(?,?),min(min(?,?),?))))

output:


result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #57:

score: 0
Time Limit Exceeded

input:

min(?,min(?,min(min(min(min(?,min(min(?,min(?,min(?,min(min(?,min(?,min(min(?,min(min(?,min(?,min(?,min(min(?,min(min(?,min(min(?,min(?,min(?,min(min(?,min(min(?,min(min(min(min(?,min(min(min(min(min(?,min(min(?,min(min(?,min(?,min(?,min(?,min(min(?,min(?,min(?,min(?,min(min(?,min(?,min(?,min(min(mi...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%