# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045656 | 2024-08-06T06:47:36 Z | 15분 56초! 15분 57초!(#11072) | Ancient Machine 2 (JOI23_ancient2) | C++17 | 0 ms | 0 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; }