Submission details
Task:Dice Summation
Sender:Ciphra
Submission time:2025-11-26 17:08:02 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.01 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.03 sdetails
#140.15 sdetails
#150.21 sdetails
#160.21 sdetails
#170.21 sdetails
#180.00 sdetails
#190.22 sdetails
#200.00 sdetails

Code


#include <algorithm>
#include <iostream>
#include <vector>
typedef long long ll;

struct Tube {
  ll in;
  ll out;
  int idx;
};


int main(){
  int n;
  std::cin >> n;
  std::vector<Tube> tubes(n);
  for (int i = 0; i<n; ++i){
    tubes[i].idx = i+1;
    std::cin >> tubes[i].in;
  }
  for (int i = 0; i<n; ++i){
    std::cin >> tubes[i].out;
  }
  
  auto cmp = [](Tube& a, Tube& b){
    return a.in < b.in;
  };

  std::sort(tubes.begin(), tubes.end(), cmp);

  int i = n-1;
  std::vector<Tube> ans;
  ans.push_back(tubes[i]);
  --i;
  while(i>=0){
    if (tubes[i].out <= ans[ans.size()-1].in){
      ans.push_back(tubes[i]);
    }
    --i;
  }


  std::cout << ans.size() << "\n";
  for (int i = ans.size() - 1; i>=0; --i){
    std::cout << ans[i].idx << " ";
  }
  std::cout << "\n";

  
}

Test details

Test 1

Verdict:

input
1

correct output
1

user output
1

Feedback: Output is longer than expected

Test 2

Verdict:

input
2

correct output
2

user output
2
1 2 

Feedback: Output is longer than expected

Test 3

Verdict:

input
3

correct output
4

user output
3
1 2 3 

Feedback: Output is longer than expected

Test 4

Verdict:

input
4

correct output
8

user output
4
1 2 3 4 

Feedback: Output is longer than expected

Test 5

Verdict:

input
5

correct output
16

user output
5
1 2 3 4 5 

Feedback: Output is longer than expected

Test 6

Verdict:

input
6

correct output
32

user output
6
1 2 3 4 5 6 

Feedback: Output is longer than expected

Test 7

Verdict:

input
7

correct output
63

user output
7
1 2 3 4 5 6 7 

Feedback: Output is longer than expected

Test 8

Verdict:

input
8

correct output
125

user output
8
1 2 3 4 5 6 7 8 

Feedback: Output is longer than expected

Test 9

Verdict:

input
9

correct output
248

user output
9
1 2 3 4 5 6 7 8 9 

Feedback: Output is longer than expected

Test 10

Verdict:

input
10

correct output
492

user output
10
1 2 3 4 5 6 7 8 9 10 

Feedback: Output is longer than expected

Test 11

Verdict:

input
50

correct output
660641036

user output
50
39 27 28 29 30 31 32 33 34 35 ...

Feedback: Output is longer than expected

Test 12

Verdict:

input
1000

correct output
937196411

user output
1000
673 658 659 660 661 662 663 66...

Feedback: Output is longer than expected

Test 13

Verdict:

input
123456

correct output
113810539

user output
123456
82299 82314 82313 82312 82311 ...

Feedback: Output is longer than expected

Test 14

Verdict:

input
654321

correct output
615247550

user output
654321
436218 436209 436210 436211 43...

Feedback: Output is longer than expected

Test 15

Verdict:

input
999998

correct output
39372206

user output
999998
666672 666657 666658 666659 66...

Feedback: Output is longer than expected

Test 16

Verdict:

input
999999

correct output
511319454

user output
999999
666672 666657 666658 666659 66...

Feedback: Output is longer than expected

Test 17

Verdict:

input
1000000

correct output
874273980

user output
1000000
666673 666658 666659 666660 66...

Feedback: Output is longer than expected

Test 18

Verdict:

input
1001

correct output
94201505

user output
1001
673 658 659 660 661 662 663 66...

Feedback: Output is longer than expected

Test 19

Verdict:

input
999997

correct output
74225807

user output
999997
666671 666656 666657 666658 66...

Feedback: Output is longer than expected

Test 20

Verdict:

input
40

correct output
567401756

user output
40
31 22 23 24 25 26 27 28 29 30 ...

Feedback: Output is longer than expected