Submission #990078

# Submission time Handle Problem Language Result Execution time Memory
990078 2024-05-29T13:48:00 Z canadavid1 Ancient Machine 2 (JOI23_ancient2) C++17
22 / 100
113 ms 1560 KB
#include "ancient2.h"

#include <string>
#include <vector>
#include <algorithm>
#include <numeric>


std::string Solve(int N) {
  // query one bit:
  // a[i], b[i] = i+1
  // a[b] = 1000
  // b[b] = 1001
  // a,b[1000] = 1000
  // a,b[1001] = 1001
  int Np = ((N+2)/3)*2+2;
  std::vector<int> a(Np+2);
  std::iota(a.begin(),a.begin()+Np,1);
  a[Np] = Np;
  a[Np+1] = Np+1;
  auto b = a;
  std::string s;
  std::string sb;
  for(int i = 0; i < Np; i++)
  {
    a[i] = Np;
    b[i] = Np+1;
    s.push_back((Query(Np+2,a,b)>Np) ? '1' : '0');
    a[i] = i+1;
    b[i] = i+1;
  }
  // now know the first 100 bits
  
  a[-1+Np/2] = 0;
  b[-1+Np/2] = 0;
  a[Np-1] = Np/2;
  b[Np-1] = Np/2;
  for(int i = Np; i < N; i++)
  {
    auto f = Np/2;
    b[i%f] = f + ((1+i)%f);
    a[f+(i%f)] = (i+1)%f;
    s.push_back((Query(a.size(),a,b)>=f ? '1' : '0'));
    b[i%f] = ((1+i)%f);
    a[f+(i%f)] = f + ((1+i)%f);
  }
  return s;
  // now know last 50 bits

  // use that information somehow
    // can query xor of arithmetic sequences (up to 50 long)
    // count how many 1's
  
}
# Verdict Execution time Memory Grader output
1 Partially correct 68 ms 412 KB Output is partially correct
2 Partially correct 65 ms 592 KB Output is partially correct
3 Partially correct 82 ms 412 KB Output is partially correct
4 Partially correct 68 ms 344 KB Output is partially correct
5 Partially correct 67 ms 412 KB Output is partially correct
6 Partially correct 65 ms 344 KB Output is partially correct
7 Partially correct 87 ms 592 KB Output is partially correct
8 Partially correct 74 ms 592 KB Output is partially correct
9 Partially correct 73 ms 412 KB Output is partially correct
10 Partially correct 71 ms 760 KB Output is partially correct
11 Partially correct 66 ms 596 KB Output is partially correct
12 Partially correct 66 ms 344 KB Output is partially correct
13 Partially correct 72 ms 1560 KB Output is partially correct
14 Partially correct 65 ms 436 KB Output is partially correct
15 Partially correct 66 ms 344 KB Output is partially correct
16 Partially correct 68 ms 1064 KB Output is partially correct
17 Partially correct 83 ms 416 KB Output is partially correct
18 Partially correct 67 ms 416 KB Output is partially correct
19 Partially correct 66 ms 412 KB Output is partially correct
20 Partially correct 84 ms 344 KB Output is partially correct
21 Partially correct 76 ms 408 KB Output is partially correct
22 Partially correct 72 ms 412 KB Output is partially correct
23 Partially correct 96 ms 412 KB Output is partially correct
24 Partially correct 66 ms 408 KB Output is partially correct
25 Partially correct 72 ms 344 KB Output is partially correct
26 Partially correct 67 ms 408 KB Output is partially correct
27 Partially correct 70 ms 588 KB Output is partially correct
28 Partially correct 92 ms 412 KB Output is partially correct
29 Partially correct 85 ms 980 KB Output is partially correct
30 Partially correct 66 ms 596 KB Output is partially correct
31 Partially correct 65 ms 344 KB Output is partially correct
32 Partially correct 82 ms 648 KB Output is partially correct
33 Partially correct 65 ms 344 KB Output is partially correct
34 Partially correct 98 ms 412 KB Output is partially correct
35 Partially correct 77 ms 1132 KB Output is partially correct
36 Partially correct 67 ms 412 KB Output is partially correct
37 Partially correct 95 ms 424 KB Output is partially correct
38 Partially correct 68 ms 1260 KB Output is partially correct
39 Partially correct 67 ms 412 KB Output is partially correct
40 Partially correct 68 ms 428 KB Output is partially correct
41 Partially correct 70 ms 596 KB Output is partially correct
42 Partially correct 67 ms 344 KB Output is partially correct
43 Partially correct 68 ms 344 KB Output is partially correct
44 Partially correct 65 ms 592 KB Output is partially correct
45 Partially correct 81 ms 344 KB Output is partially correct
46 Partially correct 65 ms 344 KB Output is partially correct
47 Partially correct 65 ms 592 KB Output is partially correct
48 Partially correct 65 ms 404 KB Output is partially correct
49 Partially correct 66 ms 416 KB Output is partially correct
50 Partially correct 87 ms 344 KB Output is partially correct
51 Partially correct 66 ms 344 KB Output is partially correct
52 Partially correct 86 ms 668 KB Output is partially correct
53 Partially correct 66 ms 344 KB Output is partially correct
54 Partially correct 84 ms 856 KB Output is partially correct
55 Partially correct 68 ms 344 KB Output is partially correct
56 Partially correct 69 ms 660 KB Output is partially correct
57 Partially correct 65 ms 408 KB Output is partially correct
58 Partially correct 66 ms 344 KB Output is partially correct
59 Partially correct 110 ms 412 KB Output is partially correct
60 Partially correct 102 ms 816 KB Output is partially correct
61 Partially correct 82 ms 416 KB Output is partially correct
62 Partially correct 113 ms 652 KB Output is partially correct
63 Partially correct 79 ms 920 KB Output is partially correct