답안 #1045667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1045667 2024-08-06T06:51:10 Z 15분 56초! 15분 57초!(#11072) Ancient Machine 2 (JOI23_ancient2) C++17
0 / 100
60 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;
      vector<int> b;
      for(int j=0;j<half;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;
      vector<int> b;
      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;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 60 ms 344 KB Output is partially correct
2 Partially correct 47 ms 344 KB Output is partially correct
3 Incorrect 48 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -