QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#136189#2414. Expeditious CubingBUET_TEAM_ONE#AC ✓1ms3584kbC++201.5kb2023-08-07 15:49:422023-08-07 15:50:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-07 15:50:10]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3584kb
  • [2023-08-07 15:49:42]
  • 提交

answer

#include <bits/stdc++.h>
typedef long long int ll;
#define endl            '\n'
#define pb             push_back
#define mp              make_pair
#define pll             pair<ll,ll> 
#define fill(x, y)     memset(x, y, sizeof(x))
#define all(x)         (x).begin(), (x).end()
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define IO	       { ios_base::sync_with_stdio(false); cin.tie(0); }
#define read(x)	       freopen(x, "r", stdin)
#define write(x)       freopen(x, "w", stdout)
#define N       1000000

using namespace std;

typedef vector<int> vi;

int inp() {
    string s;
    cin >> s;
    int val = 0;
    for (char c: s) {
        if (c >= '0' and c <= '9') val = val * 10 + (c - '0');
    }
    return val;
}

int main(){
    IO;
    cout<<fixed<<setprecision(2);
    vector<int> t;
    for (int i=0; i<4; i++) {
        
        t.push_back(inp());
    }
    sort(all(t));
    int tt = inp();

    int valid = -1;
    for (int i=0; i<2002; i++) {
        vector<int> cpy(t);
        cpy.push_back(i);
        sort(all(cpy));

        int sum = cpy[1] + cpy[2] + cpy[3];
        if (sum <= 3*tt) valid = i;
    }

    if (valid == -1) {
        cout << "impossible" << endl;
    } else if (valid == 2001) {
        cout << "infinite" << endl;
    } else {
        int x = valid / 100;
        int y = valid % 100;
        int k1 = y/10;
        int k2 = y%10;
        cout << x << "." << k1 << k2 << endl;
    }
    
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3464kb

input:

17.53 2.36 4.16 19.89
9.70

output:

7.41

result:

ok single line: '7.41'

Test #2:

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

input:

8.85 19.92 1.33 13.16
7.78

output:

1.33

result:

ok single line: '1.33'

Test #3:

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

input:

13.89 11.62 15.95 4.66
13.82

output:

infinite

result:

ok single line: 'infinite'

Test #4:

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

input:

17.68 17.68 19.57 9.78
18.31

output:

infinite

result:

ok single line: 'infinite'

Test #5:

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

input:

12.53 12.53 12.53 12.53
12.53

output:

infinite

result:

ok single line: 'infinite'

Test #6:

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

input:

12.23 17.80 12.23 12.23
12.23

output:

12.23

result:

ok single line: '12.23'

Test #7:

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

input:

4.99 4.99 11.37 4.99
4.99

output:

4.99

result:

ok single line: '4.99'

Test #8:

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

input:

5.83 11.22 9.68 5.19
6.90

output:

5.19

result:

ok single line: '5.19'

Test #9:

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

input:

6.26 6.26 9.22 6.26
6.26

output:

6.26

result:

ok single line: '6.26'

Test #10:

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

input:

6.38 7.20 6.95 8.11
7.53

output:

infinite

result:

ok single line: 'infinite'

Test #11:

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

input:

5.58 5.58 5.58 5.58
5.58

output:

infinite

result:

ok single line: 'infinite'

Test #12:

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

input:

3.44 7.49 9.67 6.38
5.77

output:

3.44

result:

ok single line: '3.44'

Test #13:

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

input:

12.80 16.43 16.96 11.35
16.50

output:

infinite

result:

ok single line: 'infinite'

Test #14:

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

input:

19.54 12.21 15.30 15.08
9.35

output:

impossible

result:

ok single line: 'impossible'

Test #15:

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

input:

14.73 17.48 15.00 17.56
3.31

output:

impossible

result:

ok single line: 'impossible'

Test #16:

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

input:

9.76 12.64 4.01 10.62
19.05

output:

infinite

result:

ok single line: 'infinite'

Test #17:

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

input:

4.00 8.96 10.26 8.42
9.94

output:

infinite

result:

ok single line: 'infinite'

Test #18:

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

input:

9.60 13.54 14.36 9.20
18.27

output:

infinite

result:

ok single line: 'infinite'

Test #19:

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

input:

1.56 19.02 10.69 13.26
14.41

output:

infinite

result:

ok single line: 'infinite'

Test #20:

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

input:

9.58 18.89 7.40 11.44
2.91

output:

impossible

result:

ok single line: 'impossible'

Test #21:

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

input:

1.45 6.89 19.25 1.44
7.65

output:

14.61

result:

ok single line: '14.61'

Test #22:

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

input:

6.38 7.20 6.95 8.11
6.99

output:

6.82

result:

ok single line: '6.82'

Test #23:

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

input:

2.26 2.68 7.02 2.42
13.03

output:

infinite

result:

ok single line: 'infinite'

Test #24:

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

input:

2.58 10.11 3.02 10.79
15.79

output:

infinite

result:

ok single line: 'infinite'

Test #25:

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

input:

14.98 7.86 14.98 11.87
14.53

output:

infinite

result:

ok single line: 'infinite'

Test #26:

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

input:

8.49 8.49 8.49 8.49
7.45

output:

impossible

result:

ok single line: 'impossible'

Test #27:

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

input:

10.10 10.80 10.80 10.80
7.65

output:

impossible

result:

ok single line: 'impossible'

Test #28:

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

input:

6.09 6.09 6.09 6.09
1.47

output:

impossible

result:

ok single line: 'impossible'

Test #29:

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

input:

1.47 2.99 2.99 3.33
3.99

output:

infinite

result:

ok single line: 'infinite'

Test #30:

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

input:

4.57 2.00 5.15 7.21
14.61

output:

infinite

result:

ok single line: 'infinite'

Test #31:

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

input:

4.96 17.88 6.55 4.96
18.74

output:

infinite

result:

ok single line: 'infinite'

Test #32:

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

input:

5.37 5.37 5.37 8.95
12.47

output:

infinite

result:

ok single line: 'infinite'

Test #33:

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

input:

6.38 7.20 6.95 8.11
6.45

output:

impossible

result:

ok single line: 'impossible'

Test #34:

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

input:

17.05 4.62 4.28 4.62
5.74

output:

7.98

result:

ok single line: '7.98'

Test #35:

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

input:

3.19 14.86 14.86 14.86
3.70

output:

impossible

result:

ok single line: 'impossible'

Test #36:

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

input:

1.87 12.12 11.61 12.12
1.87

output:

impossible

result:

ok single line: 'impossible'

Test #37:

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

input:

1.46 1.46 1.46 1.46
1.46

output:

infinite

result:

ok single line: 'infinite'

Test #38:

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

input:

14.78 12.68 18.93 14.78
14.78

output:

14.78

result:

ok single line: '14.78'

Test #39:

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

input:

18.47 9.43 18.47 18.47
9.43

output:

impossible

result:

ok single line: 'impossible'

Test #40:

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

input:

5.30 5.30 5.30 5.30
5.30

output:

infinite

result:

ok single line: 'infinite'

Test #41:

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

input:

11.48 11.48 11.48 11.48
11.48

output:

infinite

result:

ok single line: 'infinite'

Test #42:

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

input:

17.41 17.41 17.41 17.41
17.41

output:

infinite

result:

ok single line: 'infinite'

Test #43:

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

input:

7.97 7.97 7.97 7.97
7.97

output:

infinite

result:

ok single line: 'infinite'

Test #44:

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

input:

17.93 9.35 9.35 9.35
9.35

output:

9.35

result:

ok single line: '9.35'

Test #45:

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

input:

17.08 12.11 18.65 17.08
17.08

output:

17.08

result:

ok single line: '17.08'

Test #46:

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

input:

1.90 13.28 10.45 10.88
9.83

output:

8.16

result:

ok single line: '8.16'

Test #47:

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

input:

6.38 13.08 10.07 15.90
11.82

output:

12.31

result:

ok single line: '12.31'

Test #48:

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

input:

18.39 8.96 18.49 11.73
13.23

output:

9.57

result:

ok single line: '9.57'

Test #49:

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

input:

9.76 11.56 1.59 16.14
11.86

output:

14.26

result:

ok single line: '14.26'

Test #50:

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

input:

10.23 19.60 18.84 5.49
13.79

output:

12.30

result:

ok single line: '12.30'

Test #51:

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

input:

5.52 4.53 15.45 3.70
5.36

output:

6.03

result:

ok single line: '6.03'

Test #52:

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

input:

2.57 15.17 5.46 18.38
10.90

output:

12.07

result:

ok single line: '12.07'

Test #53:

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

input:

3.70 13.16 5.04 15.09
7.88

output:

5.44

result:

ok single line: '5.44'

Test #54:

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

input:

16.01 13.39 17.94 14.63
15.62

output:

16.22

result:

ok single line: '16.22'

Test #55:

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

input:

15.66 9.47 11.14 7.64
9.46

output:

7.77

result:

ok single line: '7.77'

Test #56:

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

input:

16.98 16.11 17.71 1.86
12.92

output:

5.67

result:

ok single line: '5.67'

Test #57:

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

input:

19.99 20.00 19.99 19.99
19.99

output:

19.99

result:

ok single line: '19.99'

Test #58:

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

input:

1.00 3.00 20.00 20.00
8.00

output:

1.00

result:

ok single line: '1.00'

Test #59:

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

input:

20.00 19.99 19.99 20.00
20.00

output:

infinite

result:

ok single line: 'infinite'

Test #60:

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

input:

1.00 1.00 1.01 1.01
1.00

output:

impossible

result:

ok single line: 'impossible'