QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#438553#4400. HomeworkSmilingBraniac#0 219ms377808kbC++141.5kb2024-06-10 19:20:272024-06-10 19:20:28

Judging History

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

  • [2024-06-10 19:20:28]
  • 评测
  • 测评结果:0
  • 用时:219ms
  • 内存:377808kb
  • [2024-06-10 19:20:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using R = vector<int>;

R mn(R r1, R r2) {
    int a = r1[0], b = r1[1], s1 = r1[2], c = r2[0], d = r2[1], s2 = r2[2];
    return {min(a, c), b + d - 1, s1 + s2};
}

R mx(R r1, R r2) {
    int a = r1[0], b = r1[1], s1 = r1[2], c = r2[0], d = r2[1], s2 = r2[2];
    R r = mn({s1 + 1 - b, s1 + 1 - a, s1}, {s2 + 1 - d, s2 + 1 - c, s2});
    r[0] = s1 + s2 + 1 - r[0];
    r[1] = s1 + s2 + 1 - r[1];
    return r;
}

R f(string& s, vector<vector<int>>& sum, int x, int y, int cnt) {
    if (x == y) return {1, 1, 1};
    int type = 0;
    if (s[x + 1] == 'a') type++;
    auto it = upper_bound(sum[cnt].begin(), sum[cnt].end(), x);
    if (it == sum[cnt].end() || *it >= y) {
        if (type) return {2, 2, 2};
        else return {1, 1, 2};
    }
    else if (*it + 1 == y) {
        if (type) return mx({1, 1, 1}, f(s, sum, x + 6, y - 1, cnt + 1));
        else return mn({1, 1, 1}, f(s, sum, x + 6, y - 1, cnt + 1));
    }
    else {
        if (type) return mx(f(s, sum, x + 4, *it, cnt + 1), f(s, sum, *it + 2, y - 1, cnt + 1));
        else return mn(f(s, sum, x + 4, *it, cnt + 1), f(s, sum, *it + 2, y - 1, cnt + 1));
    }
}

int main() {
    string s; cin >> s;
    int n = s.size();
    vector<vector<int>> sum(n);///
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '(') cnt++;
        if (s[i] == ')') sum[--cnt].push_back(i);
    }
    R r = f(s, sum, 0, n - 1, 1);
    cout << r[1] - r[0] + 1;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

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

output:

6

result:

ok single line: '6'

Test #2:

score: -10
Wrong Answer
time: 0ms
memory: 3580kb

input:

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

output:

1

result:

wrong answer 1st lines differ - expected: '4', found: '1'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #57:

score: 13
Accepted
time: 196ms
memory: 377196kb

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:

1

result:

ok single line: '1'

Test #58:

score: 0
Accepted
time: 215ms
memory: 377412kb

input:

max(max(max(max(max(max(max(?,max(max(max(?,max(?,max(max(max(max(max(?,max(?,max(max(?,max(max(?,max(?,max(max(max(max(max(max(max(max(max(max(?,max(?,max(?,max(?,max(max(?,max(max(max(?,max(?,max(?,max(max(max(max(max(max(max(max(?,max(?,max(max(max(?,max(?,max(?,max(?,max(?,max(?,max(max(max(?,ma...

output:

1

result:

ok single line: '1'

Test #59:

score: -13
Wrong Answer
time: 219ms
memory: 377808kb

input:

max(?,max(min(max(max(max(max(max(min(?,min(?,min(?,max(?,max(?,min(max(max(?,max(max(max(?,max(?,max(min(max(?,min(max(max(?,max(max(?,max(?,max(min(?,max(min(?,min(?,max(?,min(min(?,max(max(min(?,min(max(max(min(min(?,min(?,max(?,min(?,min(min(max(min(?,min(min(?,max(?,min(?,max(?,max(?,min(min(ma...

output:

1

result:

wrong answer 1st lines differ - expected: '999998', found: '1'

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%