제출 #1324361

#제출 시각아이디문제언어결과실행 시간메모리
1324361quollcucumber`Ancient Machine 2 (JOI23_ancient2)C++20
0 / 100
0 ms332 KiB
// using namespace std;

#include "ancient2.h"

// #include <iostream>

//IDK why my code is getting runtime error

std::string Solve(int N) {
    std::string s;
    // for(int i = 0; i < N; i++) s.push_back('0');
    // return s;
    for(int i = 0; i < N; i++) {
        std::vector<int> a;
        std::vector<int> b;
        for(int j = 0; j < 1002; j++) a.push_back(j);
        for(int j = 0; j < 1002; j++) b.push_back(j);
        if(i < 1000) {
            a[i] = 1000;
            b[i] = 1001;
            for(int j = 0; j < i; j++) {
                a[j] = j+1;
                b[j] = j+1;
            }
            if(Query(1002, a, b) == 1000) {
                s.push_back('0');
            }else {
                s.push_back('1');
            }
        }else {
            a[i] = 0;
            b[i] = 1;
            for(int j = 0; j < i; j++) {
                a[j] = j+1;
                b[j] = j+1;
            }
            if(Query(1002, a, b) == 0) {
                s.push_back('0');
            }else {
                s.push_back('1');
            }
        }
    }
    // std::cerr << s<<'\n';
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...