QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#141002 | #4400. Homework | juanda_o_182# | 10 | 15ms | 3760kb | C++23 | 896b | 2023-08-17 05:26:11 | 2024-07-04 01:46:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
string n;
string w="";
set<long long>posib;
long long cont;
stack<long long>s;
int main(){
cin>>n;
for(int i=0;i< int(n.size());i++){
if (n[i]=='n'){
w+='n';
}else if(n[i]=='x'){
w+='x';
}else if(n[i]=='?'){
w+='?';
cont+=1;
}
}
vector<long long>p(cont);
for(long long i=0;i<cont;i++){
p[i]=i;
}
long long a,b;
do{
long long pos=0;
for(int i= w.size()-1;i>=0;i--){
if (w[i]=='?'){
s.push(p[pos]+1);
pos+=1;
}else if(w[i]=='n'){
a=s.top();
s.pop();
b=s.top();
s.pop();
s.push(min(a,b));
}else if(w[i]=='x'){
a=s.top();
s.pop();
b=s.top();
s.pop();
s.push(max(a,b));
}
}
posib.insert(s.top());
s.pop();
}while(next_permutation(p.begin(),p.end()));
cout<<posib.size()<<endl;
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 14ms
memory: 3580kb
input:
min(max(?,max(min(?,min(?,?)),?)),min(max(?,?),max(?,?)))
output:
6
result:
ok single line: '6'
Test #2:
score: 10
Accepted
time: 14ms
memory: 3456kb
input:
max(max(?,min(max(?,min(?,?)),?)),max(max(?,?),max(?,?)))
output:
4
result:
ok single line: '4'
Test #3:
score: 10
Accepted
time: 13ms
memory: 3688kb
input:
min(min(min(?,min(?,?)),min(?,?)),min(?,min(min(?,?),?)))
output:
1
result:
ok single line: '1'
Test #4:
score: 10
Accepted
time: 13ms
memory: 3668kb
input:
max(max(max(?,?),?),max(max(?,?),min(max(?,?),max(?,?))))
output:
3
result:
ok single line: '3'
Test #5:
score: 10
Accepted
time: 7ms
memory: 3672kb
input:
min(max(?,min(?,?)),max(min(max(?,?),?),min(max(?,?),?)))
output:
6
result:
ok single line: '6'
Test #6:
score: 10
Accepted
time: 13ms
memory: 3672kb
input:
max(max(?,min(max(?,?),?)),max(max(max(?,?),min(?,?)),?))
output:
4
result:
ok single line: '4'
Test #7:
score: 10
Accepted
time: 12ms
memory: 3572kb
input:
min(min(max(min(?,?),?),?),min(?,max(max(?,?),min(?,?))))
output:
6
result:
ok single line: '6'
Test #8:
score: 10
Accepted
time: 13ms
memory: 3564kb
input:
min(min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?))),?)
output:
2
result:
ok single line: '2'
Test #9:
score: 10
Accepted
time: 12ms
memory: 3560kb
input:
max(max(?,?),max(max(max(?,?),max(?,?)),max(?,max(?,?))))
output:
1
result:
ok single line: '1'
Test #10:
score: 10
Accepted
time: 14ms
memory: 3668kb
input:
min(max(min(?,?),?),max(min(?,max(min(max(?,?),?),?)),?))
output:
7
result:
ok single line: '7'
Test #11:
score: 10
Accepted
time: 15ms
memory: 3672kb
input:
max(?,min(max(?,min(?,?)),max(max(?,?),min(?,max(?,?)))))
output:
7
result:
ok single line: '7'
Test #12:
score: 10
Accepted
time: 15ms
memory: 3572kb
input:
min(min(max(?,?),?),max(max(?,min(max(?,?),?)),max(?,?)))
output:
7
result:
ok single line: '7'
Test #13:
score: 10
Accepted
time: 13ms
memory: 3584kb
input:
min(min(min(?,?),min(?,max(?,?))),min(?,min(?,min(?,?))))
output:
2
result:
ok single line: '2'
Test #14:
score: 10
Accepted
time: 14ms
memory: 3520kb
input:
min(max(max(?,?),max(?,max(max(?,?),max(?,?)))),max(?,?))
output:
7
result:
ok single line: '7'
Test #15:
score: 10
Accepted
time: 13ms
memory: 3760kb
input:
max(min(?,?),min(max(min(?,?),min(?,max(?,min(?,?)))),?))
output:
7
result:
ok single line: '7'
Test #16:
score: 10
Accepted
time: 11ms
memory: 3520kb
input:
min(?,min(?,max(max(max(min(?,min(min(?,?),?)),?),?),?)))
output:
7
result:
ok single line: '7'
Test #17:
score: 10
Accepted
time: 15ms
memory: 3576kb
input:
min(?,min(?,max(?,max(min(min(min(?,min(?,?)),?),?),?))))
output:
7
result:
ok single line: '7'
Test #18:
score: 10
Accepted
time: 10ms
memory: 3576kb
input:
min(?,min(min(min(?,min(?,min(?,min(min(?,?),?)))),?),?))
output:
1
result:
ok single line: '1'
Test #19:
score: 10
Accepted
time: 11ms
memory: 3556kb
input:
max(max(max(?,max(?,max(?,max(?,max(max(?,?),?))))),?),?)
output:
1
result:
ok single line: '1'
Test #20:
score: 10
Accepted
time: 13ms
memory: 3528kb
input:
min(max(?,min(max(min(max(min(?,max(?,?)),?),?),?),?)),?)
output:
8
result:
ok single line: '8'
Test #21:
score: 10
Accepted
time: 11ms
memory: 3564kb
input:
min(min(?,?),min(min(min(?,?),min(min(?,min(?,?)),?)),?))
output:
1
result:
ok single line: '1'
Test #22:
score: 10
Accepted
time: 12ms
memory: 3580kb
input:
max(max(max(?,?),max(max(?,?),?)),max(max(?,?),max(?,?)))
output:
1
result:
ok single line: '1'
Test #23:
score: 10
Accepted
time: 15ms
memory: 3712kb
input:
min(max(?,min(max(?,?),?)),min(?,min(?,min(?,max(?,?)))))
output:
5
result:
ok single line: '5'
Test #24:
score: 10
Accepted
time: 14ms
memory: 3516kb
input:
min(?,max(min(min(max(?,?),?),max(?,?)),min(min(?,?),?)))
output:
6
result:
ok single line: '6'
Test #25:
score: 10
Accepted
time: 2ms
memory: 3692kb
input:
min(min(min(?,?),max(?,?)),min(min(?,?),min(?,?)))
output:
2
result:
ok single line: '2'
Test #26:
score: 10
Accepted
time: 2ms
memory: 3456kb
input:
min(min(min(?,?),min(?,?)),min(min(?,?),min(?,?)))
output:
1
result:
ok single line: '1'
Test #27:
score: 10
Accepted
time: 0ms
memory: 3572kb
input:
max(min(max(?,?),max(?,?)),min(max(?,?),max(?,?)))
output:
4
result:
ok single line: '4'
Test #28:
score: 10
Accepted
time: 0ms
memory: 3580kb
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%