Submission #1045699

# Submission time Handle Problem Language Result Execution time Memory
1045699 2024-08-06T07:01:11 Z 15분 56초! 15분 57초!(#11072) Ancient Machine 2 (JOI23_ancient2) C++17
37 / 100
74 ms 356 KB
#include "ancient2.h"

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

namespace {

int variable_example = 1;

}  // namespace

int ret[1000];

std::string Solve(int N) {
  std::string s(N, '0');
  int half=(N+1)/2;
  for(int i=0;i<half;i++) {
      vector<int> a(half+2);
      vector<int> b(half+2);
      for(int j=0;j<half;j++) {
          if (j==half-1) {
              a[j]=half+1;
          }
          else {
              a[j]=j+1;
          }
          if (j==i) {
              b[j]=half;
          }
          else if (j!=half-1) {
              b[j]=j+1;
          }
          else {
              b[j]=half+1;
          }
      }
      a[half]=half;
      b[half]=half;
      a[half+1]=half+1;
      b[half+1]=half+1;
      if (Query(half+2,a,b)==half) {
          ret[i]=1;
      }
      else {
          ret[i]=0;
      }
  }
   for(int i=0;i<N-half;i++) {
      vector<int> a(half+1);
      vector<int> b(half+1);
      for(int j=0;j<half;j++) {
          if (ret[i]==0) {
              a[j]=((j+1)%half);
              if (j==i) {
                  b[j]=half;
              }
              else {
                  b[j]=((j+1)%half);
              }
          }
          else {
              b[j]=((j+1)%half);
              if (j==i) {
                  a[j]=half;
              }
              else {
                  a[j]=(j+1)%half;
              }
          }
      }
      a[half]=half;
      b[half]=half;
      if (Query(half+1,a,b)==half) {
          ret[i+half]=1-ret[i];
      }
      else {
          ret[i+half]=ret[i];
      }
  }
  for(int i=0;i<N;i++) {
      s[i]=(ret[i]?'1':'0');
  }
  return s;
}

Compilation message

ancient2.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 48 ms 344 KB Output is partially correct
2 Partially correct 54 ms 344 KB Output is partially correct
3 Partially correct 46 ms 344 KB Output is partially correct
4 Partially correct 46 ms 344 KB Output is partially correct
5 Partially correct 55 ms 344 KB Output is partially correct
6 Partially correct 51 ms 344 KB Output is partially correct
7 Partially correct 74 ms 344 KB Output is partially correct
8 Partially correct 46 ms 344 KB Output is partially correct
9 Partially correct 73 ms 344 KB Output is partially correct
10 Partially correct 53 ms 344 KB Output is partially correct
11 Partially correct 55 ms 344 KB Output is partially correct
12 Partially correct 68 ms 344 KB Output is partially correct
13 Partially correct 49 ms 340 KB Output is partially correct
14 Partially correct 52 ms 344 KB Output is partially correct
15 Partially correct 46 ms 344 KB Output is partially correct
16 Partially correct 45 ms 344 KB Output is partially correct
17 Partially correct 51 ms 344 KB Output is partially correct
18 Partially correct 45 ms 344 KB Output is partially correct
19 Partially correct 63 ms 344 KB Output is partially correct
20 Partially correct 46 ms 344 KB Output is partially correct
21 Partially correct 59 ms 344 KB Output is partially correct
22 Partially correct 46 ms 356 KB Output is partially correct
23 Partially correct 52 ms 344 KB Output is partially correct
24 Partially correct 54 ms 344 KB Output is partially correct
25 Partially correct 57 ms 344 KB Output is partially correct
26 Partially correct 46 ms 340 KB Output is partially correct
27 Partially correct 45 ms 344 KB Output is partially correct
28 Partially correct 57 ms 344 KB Output is partially correct
29 Partially correct 72 ms 344 KB Output is partially correct
30 Partially correct 49 ms 344 KB Output is partially correct
31 Partially correct 44 ms 344 KB Output is partially correct
32 Partially correct 46 ms 344 KB Output is partially correct
33 Partially correct 62 ms 344 KB Output is partially correct
34 Partially correct 55 ms 344 KB Output is partially correct
35 Partially correct 65 ms 344 KB Output is partially correct
36 Partially correct 58 ms 344 KB Output is partially correct
37 Partially correct 55 ms 344 KB Output is partially correct
38 Partially correct 46 ms 344 KB Output is partially correct
39 Partially correct 46 ms 344 KB Output is partially correct
40 Partially correct 59 ms 344 KB Output is partially correct
41 Partially correct 59 ms 344 KB Output is partially correct
42 Partially correct 46 ms 344 KB Output is partially correct
43 Partially correct 44 ms 344 KB Output is partially correct
44 Partially correct 49 ms 344 KB Output is partially correct
45 Partially correct 49 ms 344 KB Output is partially correct
46 Partially correct 54 ms 344 KB Output is partially correct
47 Partially correct 48 ms 344 KB Output is partially correct
48 Partially correct 54 ms 344 KB Output is partially correct
49 Partially correct 58 ms 344 KB Output is partially correct
50 Partially correct 47 ms 344 KB Output is partially correct
51 Partially correct 45 ms 344 KB Output is partially correct
52 Partially correct 59 ms 344 KB Output is partially correct
53 Partially correct 54 ms 344 KB Output is partially correct
54 Partially correct 63 ms 344 KB Output is partially correct
55 Partially correct 61 ms 344 KB Output is partially correct
56 Partially correct 54 ms 344 KB Output is partially correct
57 Partially correct 46 ms 344 KB Output is partially correct
58 Partially correct 47 ms 344 KB Output is partially correct
59 Partially correct 50 ms 344 KB Output is partially correct
60 Partially correct 53 ms 344 KB Output is partially correct
61 Partially correct 55 ms 344 KB Output is partially correct
62 Partially correct 74 ms 344 KB Output is partially correct
63 Partially correct 52 ms 344 KB Output is partially correct