QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#140042 | #4400. Homework | APROHACK | 10 | 9ms | 3600kb | C++14 | 1.5kb | 2023-08-15 00:23:55 | 2023-08-15 00:23:55 |
Judging History
answer
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ff first
#define ss second
using namespace std;
string s;
int n;
int cur = 0;
vector<int>test;
struct node{
node *L, *R;
int idx;
bool isMax;
bool isHoja;
node (int l, int r){
if(r == l){
//cout << "hoja " << endl;
idx = cur ++ ;
isHoja = true;
}else{
isHoja = false;
int cuenta = 0;
int l2 = 0;
isMax = s[l+1] == 'a';
//cout<< "ismax: " << isMax << endl;
l += 4;
for(int i = l ; i <= r ; i ++){
if(cuenta == 0 and s[i] == ','){
//cout << "left: " << endl;
L = new node(l, i-1);
l2 = i + 1;
break;
}else if(s[i] == '(')cuenta ++;
else if(s[i] == ')')cuenta -- ;
}
//cout << "right " << endl;
R = new node(l2, r-1);
}
}
int process(){
if(isHoja)return test[idx];
else if(isMax)return max(L->process(), R->process());
else return min(L->process(), R->process());
}
};
node *root;
int main(){
ios::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin >> s;
n = s.size();
root = new node(0, n-1);
for(int i = 0 ; i < cur ; i ++)test.pb(i+1);
int posible[cur+2];
memset(posible, false, sizeof posible);
do{
posible[root->process()] = true;
}while(next_permutation(test.begin(), test.end()));
int ans = 0;
for(int i = 1 ; i <= cur + 1 ; i ++){
if(posible[i])ans ++ ;
}
cout << ans << "\n";
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 8ms
memory: 3512kb
input:
min(max(?,max(min(?,min(?,?)),?)),min(max(?,?),max(?,?)))
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 8ms
memory: 3476kb
input:
max(max(?,min(max(?,min(?,?)),?)),max(max(?,?),max(?,?)))
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 5ms
memory: 3468kb
input:
min(min(min(?,min(?,?)),min(?,?)),min(?,min(min(?,?),?)))
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 7ms
memory: 3584kb
input:
max(max(max(?,?),?),max(max(?,?),min(max(?,?),max(?,?))))
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 8ms
memory: 3532kb
input:
min(max(?,min(?,?)),max(min(max(?,?),?),min(max(?,?),?)))
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 7ms
memory: 3544kb
input:
max(max(?,min(max(?,?),?)),max(max(max(?,?),min(?,?)),?))
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 7ms
memory: 3520kb
input:
min(min(max(min(?,?),?),?),min(?,max(max(?,?),min(?,?))))
output:
6
result:
ok single line: '6'
Test #8:
score: 0
Accepted
time: 8ms
memory: 3536kb
input:
min(min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?))),?)
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 5ms
memory: 3480kb
input:
max(max(?,?),max(max(max(?,?),max(?,?)),max(?,max(?,?))))
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 8ms
memory: 3472kb
input:
min(max(min(?,?),?),max(min(?,max(min(max(?,?),?),?)),?))
output:
7
result:
ok single line: '7'
Test #11:
score: 0
Accepted
time: 5ms
memory: 3540kb
input:
max(?,min(max(?,min(?,?)),max(max(?,?),min(?,max(?,?)))))
output:
7
result:
ok single line: '7'
Test #12:
score: 0
Accepted
time: 8ms
memory: 3536kb
input:
min(min(max(?,?),?),max(max(?,min(max(?,?),?)),max(?,?)))
output:
7
result:
ok single line: '7'
Test #13:
score: 0
Accepted
time: 5ms
memory: 3468kb
input:
min(min(min(?,?),min(?,max(?,?))),min(?,min(?,min(?,?))))
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 8ms
memory: 3476kb
input:
min(max(max(?,?),max(?,max(max(?,?),max(?,?)))),max(?,?))
output:
7
result:
ok single line: '7'
Test #15:
score: 0
Accepted
time: 7ms
memory: 3540kb
input:
max(min(?,?),min(max(min(?,?),min(?,max(?,min(?,?)))),?))
output:
7
result:
ok single line: '7'
Test #16:
score: 0
Accepted
time: 6ms
memory: 3484kb
input:
min(?,min(?,max(max(max(min(?,min(min(?,?),?)),?),?),?)))
output:
7
result:
ok single line: '7'
Test #17:
score: 0
Accepted
time: 8ms
memory: 3540kb
input:
min(?,min(?,max(?,max(min(min(min(?,min(?,?)),?),?),?))))
output:
7
result:
ok single line: '7'
Test #18:
score: 0
Accepted
time: 8ms
memory: 3476kb
input:
min(?,min(min(min(?,min(?,min(?,min(min(?,?),?)))),?),?))
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 7ms
memory: 3544kb
input:
max(max(max(?,max(?,max(?,max(?,max(max(?,?),?))))),?),?)
output:
1
result:
ok single line: '1'
Test #20:
score: 0
Accepted
time: 8ms
memory: 3544kb
input:
min(max(?,min(max(min(max(min(?,max(?,?)),?),?),?),?)),?)
output:
8
result:
ok single line: '8'
Test #21:
score: 0
Accepted
time: 8ms
memory: 3532kb
input:
min(min(?,?),min(min(min(?,?),min(min(?,min(?,?)),?)),?))
output:
1
result:
ok single line: '1'
Test #22:
score: 0
Accepted
time: 9ms
memory: 3540kb
input:
max(max(max(?,?),max(max(?,?),?)),max(max(?,?),max(?,?)))
output:
1
result:
ok single line: '1'
Test #23:
score: 0
Accepted
time: 5ms
memory: 3484kb
input:
min(max(?,min(max(?,?),?)),min(?,min(?,min(?,max(?,?)))))
output:
5
result:
ok single line: '5'
Test #24:
score: 0
Accepted
time: 8ms
memory: 3540kb
input:
min(?,max(min(min(max(?,?),?),max(?,?)),min(min(?,?),?)))
output:
6
result:
ok single line: '6'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?)))
output:
2
result:
ok single line: '2'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
min(min(min(?,?),min(?,?)),min(min(?,?),min(?,?)))
output:
1
result:
ok single line: '1'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
max(min(max(?,?),max(?,?)),min(max(?,?),max(?,?)))
output:
4
result:
ok single line: '4'
Test #28:
score: 0
Accepted
time: 2ms
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%