QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#134546#4400. HomeworkChrisM2309#10 103ms3824kbC++202.2kb2023-08-03 23:21:092024-07-04 01:15:58

Judging History

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

  • [2024-07-04 01:15:58]
  • 评测
  • 测评结果:10
  • 用时:103ms
  • 内存:3824kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-03 23:21:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

//* SETIO
void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}}


void RESOLVER(){
   string s;
   cin >> s;
   int n = 0;
   vector<int> pos;
   for (int i = 0; i < s.size(); i++){
        if(s[i] == '?') pos.push_back(i);
   }
   n = pos.size();
   vector<int> perm(n);
   set<int> ans;
   for (int i = 1; i <= n; i++) perm[i - 1] = i;
   do{  
        string p = s;
        int cont = 0;
        for (auto x : pos){
            p[x] = (perm[cont] + '0');
            cont++;
        }
        while(p.size() > 1){
        for (int i = 0; i < p.size(); i++){
            //!min
            //* i = i, i + 1 = n, i + 2 = (, i + 3 = ?
            if(p[i] == 'i'){
                if (p[i + 3] <= '9' and p[i + 5] <= '9'){
                    //cout << "si ";
                    int v1 = p[i + 3] - '0';
                    int v2 = p[i + 5] - '0';
                    int val = min(v1, v2);
                    //cout << p << " ";
                    p.insert(p.begin() + i + 7, val + '0');
                    p.erase(i - 1, 8);
                    //cout << val << "\n";
                
                }
                //cout << "\n";
            }
            //!max
            if(p[i] == 'a'){
                if (p[i + 3] <= '9' and p[i + 5] <= '9'){
                    //cout << "si ";
                    int v1 = p[i + 3] - '0';
                    int v2 = p[i + 5] - '0';
                    int val =  max(v1, v2);
                    //cout << p << " ";
                    p.insert(p.begin() + i + 7, val + '0');
                    p.erase(i - 1, 8);
                    //cout << val << "\n";
                
                }
                //cout << "\n";
            }
        }
        }
        ans.insert(p[0] + '0');
        //cout << p;
        //cout << "\n";
   } while (next_permutation(perm.begin(), perm.end()));
   
    cout << ans.size();
}

int main(){
    //!ChrisM
    setIO("");
    int t = 1;
    //cin >> t;
    while(t--){
    RESOLVER();
    }
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 66ms
memory: 3532kb

input:

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

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 63ms
memory: 3524kb

input:

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

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 54ms
memory: 3524kb

input:

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

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 58ms
memory: 3752kb

input:

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

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 57ms
memory: 3604kb

input:

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

output:

6

result:

ok single line: '6'

Test #6:

score: 0
Accepted
time: 62ms
memory: 3592kb

input:

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

output:

4

result:

ok single line: '4'

Test #7:

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

input:

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

output:

6

result:

ok single line: '6'

Test #8:

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

input:

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

output:

2

result:

ok single line: '2'

Test #9:

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

input:

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

output:

1

result:

ok single line: '1'

Test #10:

score: 0
Accepted
time: 71ms
memory: 3612kb

input:

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

output:

7

result:

ok single line: '7'

Test #11:

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

input:

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

output:

7

result:

ok single line: '7'

Test #12:

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

input:

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

output:

7

result:

ok single line: '7'

Test #13:

score: 0
Accepted
time: 58ms
memory: 3748kb

input:

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

output:

2

result:

ok single line: '2'

Test #14:

score: 0
Accepted
time: 64ms
memory: 3596kb

input:

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

output:

7

result:

ok single line: '7'

Test #15:

score: 0
Accepted
time: 66ms
memory: 3524kb

input:

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

output:

7

result:

ok single line: '7'

Test #16:

score: 0
Accepted
time: 87ms
memory: 3752kb

input:

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

output:

7

result:

ok single line: '7'

Test #17:

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

input:

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

output:

7

result:

ok single line: '7'

Test #18:

score: 0
Accepted
time: 81ms
memory: 3748kb

input:

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

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 103ms
memory: 3592kb

input:

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

output:

1

result:

ok single line: '1'

Test #20:

score: 0
Accepted
time: 86ms
memory: 3752kb

input:

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

output:

8

result:

ok single line: '8'

Test #21:

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

input:

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

output:

1

result:

ok single line: '1'

Test #22:

score: 0
Accepted
time: 57ms
memory: 3592kb

input:

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

output:

1

result:

ok single line: '1'

Test #23:

score: 0
Accepted
time: 65ms
memory: 3540kb

input:

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

output:

5

result:

ok single line: '5'

Test #24:

score: 0
Accepted
time: 63ms
memory: 3824kb

input:

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

output:

6

result:

ok single line: '6'

Test #25:

score: 0
Accepted
time: 5ms
memory: 3596kb

input:

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

output:

2

result:

ok single line: '2'

Test #26:

score: 0
Accepted
time: 5ms
memory: 3748kb

input:

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

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 5ms
memory: 3544kb

input:

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

output:

4

result:

ok single line: '4'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3824kb

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%