답안 #1045716

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1045716 2024-08-06T07:07:45 Z 정민찬(#11016) Ancient Machine 2 (JOI23_ancient2) C++17
10 / 100
83 ms 1368 KB
#include "ancient2.h"

#include <bits/stdc++.h>

using namespace std;

int Query(int m, vector<int> a, vector<int> b);

string Solve(int N) {
    //assert(N == 1000);
    string ans;
    for (int i=0; i<N; i++) {
        vector<int> qa, qb;
        for (int j=0; j<i; j++) {
            qa.push_back(j+1);
            qb.push_back(j+1);
        }
        qa.push_back(i+1);
        qa.push_back(i+1);
        qa.push_back(i+2);
        qb.push_back(i+2);
        qb.push_back(i+1);
        qb.push_back(i+2);
        int ret = Query(qa.size(), qa, qb);
        if (ret == i+1) ans.push_back('0');
        else ans.push_back('1');
    }
    return ans;
}
/*
namespace {

using std::exit;
using std::fprintf;
using std::printf;
using std::scanf;

constexpr int N_MAX = 1000;
constexpr int M_MAX = 1002;
constexpr int Q_MAX = 1000;

int N;
char S[N_MAX + 1];

int query_count = 0;
int query_m_max = 0;

void WrongAnswer(int code) {
  printf("Wrong Answer [%d]\n", code);
  exit(0);
}
}  // namespace

int Query(int m, std::vector<int> a, std::vector<int> b) {
  if (++query_count > Q_MAX) WrongAnswer(7);
  if (!(1 <= m && m <= M_MAX)) WrongAnswer(4);
  if ((int)a.size() != m || (int)b.size() != m) WrongAnswer(5);
  for (int i = 0; i < m; i++) {
    if (!(0 <= a[i] && a[i] <= m - 1) || !(0 <= b[i] && b[i] <= m - 1))
      WrongAnswer(6);
  }
  if (m > query_m_max) query_m_max = m;
  int memory = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '0') {
      memory = a[memory];
    }
    if (S[i] == '1') {
      memory = b[memory];
    }
  }
  return memory;
}

int main() {
  if (scanf("%d", &N) != 1) {
    fprintf(stderr, "Error while reading input.\n");
    exit(1);
  }
  if (scanf("%s", S) != 1) {
    fprintf(stderr, "Error while reading input.\n");
    exit(1);
  }
  std::string s = Solve(N);
  if ((int)s.size() != N) WrongAnswer(1);
  for (int i = 0; i < N; i++) {
    if (!(s[i] == '0' || s[i] == '1')) WrongAnswer(2);
  }
  for (int i = 0; i < N; i++) {
    if (s[i] != S[i]) WrongAnswer(3);
  }
  printf("Accepted: %d\n", query_m_max);
  return 0;
}

*/
# 결과 실행 시간 메모리 Grader output
1 Partially correct 45 ms 344 KB Output is partially correct
2 Partially correct 49 ms 344 KB Output is partially correct
3 Partially correct 45 ms 496 KB Output is partially correct
4 Partially correct 48 ms 1164 KB Output is partially correct
5 Partially correct 53 ms 508 KB Output is partially correct
6 Partially correct 55 ms 496 KB Output is partially correct
7 Partially correct 48 ms 500 KB Output is partially correct
8 Partially correct 50 ms 1368 KB Output is partially correct
9 Partially correct 63 ms 588 KB Output is partially correct
10 Partially correct 52 ms 496 KB Output is partially correct
11 Partially correct 56 ms 592 KB Output is partially correct
12 Partially correct 58 ms 676 KB Output is partially correct
13 Partially correct 46 ms 512 KB Output is partially correct
14 Partially correct 48 ms 600 KB Output is partially correct
15 Partially correct 45 ms 344 KB Output is partially correct
16 Partially correct 45 ms 496 KB Output is partially correct
17 Partially correct 45 ms 704 KB Output is partially correct
18 Partially correct 75 ms 804 KB Output is partially correct
19 Partially correct 49 ms 592 KB Output is partially correct
20 Partially correct 47 ms 516 KB Output is partially correct
21 Partially correct 45 ms 524 KB Output is partially correct
22 Partially correct 56 ms 720 KB Output is partially correct
23 Partially correct 55 ms 496 KB Output is partially correct
24 Partially correct 68 ms 564 KB Output is partially correct
25 Partially correct 45 ms 496 KB Output is partially correct
26 Partially correct 58 ms 512 KB Output is partially correct
27 Partially correct 65 ms 856 KB Output is partially correct
28 Partially correct 72 ms 672 KB Output is partially correct
29 Partially correct 69 ms 496 KB Output is partially correct
30 Partially correct 48 ms 604 KB Output is partially correct
31 Partially correct 47 ms 744 KB Output is partially correct
32 Partially correct 72 ms 344 KB Output is partially correct
33 Partially correct 50 ms 1216 KB Output is partially correct
34 Partially correct 48 ms 600 KB Output is partially correct
35 Partially correct 51 ms 600 KB Output is partially correct
36 Partially correct 59 ms 492 KB Output is partially correct
37 Partially correct 53 ms 896 KB Output is partially correct
38 Partially correct 47 ms 516 KB Output is partially correct
39 Partially correct 68 ms 344 KB Output is partially correct
40 Partially correct 54 ms 512 KB Output is partially correct
41 Partially correct 47 ms 600 KB Output is partially correct
42 Partially correct 48 ms 496 KB Output is partially correct
43 Partially correct 73 ms 656 KB Output is partially correct
44 Partially correct 61 ms 592 KB Output is partially correct
45 Partially correct 83 ms 516 KB Output is partially correct
46 Partially correct 62 ms 504 KB Output is partially correct
47 Partially correct 45 ms 700 KB Output is partially correct
48 Partially correct 45 ms 344 KB Output is partially correct
49 Partially correct 54 ms 600 KB Output is partially correct
50 Partially correct 54 ms 756 KB Output is partially correct
51 Partially correct 79 ms 500 KB Output is partially correct
52 Partially correct 51 ms 496 KB Output is partially correct
53 Partially correct 54 ms 500 KB Output is partially correct
54 Partially correct 47 ms 600 KB Output is partially correct
55 Partially correct 46 ms 744 KB Output is partially correct
56 Partially correct 46 ms 600 KB Output is partially correct
57 Partially correct 48 ms 512 KB Output is partially correct
58 Partially correct 47 ms 512 KB Output is partially correct
59 Partially correct 66 ms 732 KB Output is partially correct
60 Partially correct 53 ms 744 KB Output is partially correct
61 Partially correct 76 ms 632 KB Output is partially correct
62 Partially correct 51 ms 1132 KB Output is partially correct
63 Partially correct 70 ms 344 KB Output is partially correct