Submission #1045657

# Submission time Handle Problem Language Result Execution time Memory
1045657 2024-08-06T06:47:53 Z 15분 56초! 15분 57초!(#11072) Ancient Machine 2 (JOI23_ancient2) C++17
0 / 100
0 ms 344 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<500;j++) {
          if (j==half-1) {
              a.push_back(half+1);
          }
          else {
              a.push_back(j+1);
          }
          if (j==i) {
              b.push_back(half);
          }
          else {
              b.push_back(j+1);
          }
      }
      a.push_back(half);
      b.push_back(half);
      a.push_back(half+1);
      b.push_back(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.push_back((j+1)%half);
              if (j==i) {
                  b.push_back(half);
              }
              else {
                  b.push_back((j+1)%half);
              }
          }
          else {
              b.push_back((j+1)%half);
              if (j==i) {
                  a.push_back(half);
              }
              else {
                  a.push_back((j+1)%half);
              }
          }
      }
      a.push_back(half);
      b.push_back(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 Incorrect 0 ms 344 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -