답안 #990196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990196 2024-05-29T21:06:46 Z canadavid1 Ancient Machine 2 (JOI23_ancient2) C++17
37 / 100
82 ms 596 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 = 500;
  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;
  }
  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 < Np + (Np/2); i++)
  {
    auto f = Np/2;
    // query xor of bits in residue class
    b[i%f] = f+(1+i)%f;
    b[f+(i%f)] = (1+i)%f;
    s.push_back((Query(a.size(),a,b)>=f ? '1' : '0'));
    b[i%f] = (1+i)%f;
    b[f+(i%f)] = f+(1+i)%f;
  }
  
  
  for(int i = Np+(Np/2); 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);
  }
  for(int i = 0; i < 250; i++)
  {
    s[500+i] = ((s[i]=='1') ^ (s[250+i]=='1') ^ (s[500+i]=='1') ^ (s[750+i]=='1')) ? '1' : '0';
  }

  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
  
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 61 ms 508 KB Output is partially correct
2 Partially correct 50 ms 344 KB Output is partially correct
3 Partially correct 49 ms 344 KB Output is partially correct
4 Partially correct 51 ms 404 KB Output is partially correct
5 Partially correct 50 ms 344 KB Output is partially correct
6 Partially correct 61 ms 408 KB Output is partially correct
7 Partially correct 53 ms 596 KB Output is partially correct
8 Partially correct 52 ms 412 KB Output is partially correct
9 Partially correct 56 ms 344 KB Output is partially correct
10 Partially correct 66 ms 404 KB Output is partially correct
11 Partially correct 50 ms 344 KB Output is partially correct
12 Partially correct 68 ms 404 KB Output is partially correct
13 Partially correct 53 ms 344 KB Output is partially correct
14 Partially correct 50 ms 592 KB Output is partially correct
15 Partially correct 51 ms 408 KB Output is partially correct
16 Partially correct 75 ms 344 KB Output is partially correct
17 Partially correct 56 ms 408 KB Output is partially correct
18 Partially correct 58 ms 592 KB Output is partially correct
19 Partially correct 50 ms 404 KB Output is partially correct
20 Partially correct 50 ms 412 KB Output is partially correct
21 Partially correct 66 ms 596 KB Output is partially correct
22 Partially correct 65 ms 404 KB Output is partially correct
23 Partially correct 64 ms 412 KB Output is partially correct
24 Partially correct 65 ms 596 KB Output is partially correct
25 Partially correct 64 ms 408 KB Output is partially correct
26 Partially correct 50 ms 344 KB Output is partially correct
27 Partially correct 50 ms 408 KB Output is partially correct
28 Partially correct 62 ms 344 KB Output is partially correct
29 Partially correct 50 ms 404 KB Output is partially correct
30 Partially correct 52 ms 408 KB Output is partially correct
31 Partially correct 65 ms 408 KB Output is partially correct
32 Partially correct 54 ms 408 KB Output is partially correct
33 Partially correct 57 ms 408 KB Output is partially correct
34 Partially correct 50 ms 344 KB Output is partially correct
35 Partially correct 53 ms 408 KB Output is partially correct
36 Partially correct 50 ms 344 KB Output is partially correct
37 Partially correct 50 ms 344 KB Output is partially correct
38 Partially correct 50 ms 344 KB Output is partially correct
39 Partially correct 52 ms 408 KB Output is partially correct
40 Partially correct 50 ms 344 KB Output is partially correct
41 Partially correct 61 ms 412 KB Output is partially correct
42 Partially correct 64 ms 404 KB Output is partially correct
43 Partially correct 70 ms 592 KB Output is partially correct
44 Partially correct 61 ms 344 KB Output is partially correct
45 Partially correct 51 ms 412 KB Output is partially correct
46 Partially correct 53 ms 404 KB Output is partially correct
47 Partially correct 51 ms 424 KB Output is partially correct
48 Partially correct 60 ms 404 KB Output is partially correct
49 Partially correct 55 ms 404 KB Output is partially correct
50 Partially correct 53 ms 344 KB Output is partially correct
51 Partially correct 59 ms 408 KB Output is partially correct
52 Partially correct 49 ms 344 KB Output is partially correct
53 Partially correct 50 ms 408 KB Output is partially correct
54 Partially correct 82 ms 344 KB Output is partially correct
55 Partially correct 52 ms 344 KB Output is partially correct
56 Partially correct 50 ms 404 KB Output is partially correct
57 Partially correct 60 ms 404 KB Output is partially correct
58 Partially correct 63 ms 404 KB Output is partially correct
59 Partially correct 72 ms 344 KB Output is partially correct
60 Partially correct 50 ms 344 KB Output is partially correct
61 Partially correct 67 ms 408 KB Output is partially correct
62 Partially correct 50 ms 404 KB Output is partially correct
63 Partially correct 55 ms 416 KB Output is partially correct