# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1045678 |
2024-08-06T06:54:45 Z |
15분 56초! 15분 57초!(#11072) |
Ancient Machine 2 (JOI23_ancient2) |
C++17 |
|
65 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<half;j++) {
if (j==half-1) {
a[j]=half+1;
}
else {
a[j]=j+1;
}
if (j==i) {
b[j]=half;
}
else {
b[j]=j+1;
}
}
a[half]=half;
b[half]=half;
a[half+1]=half+1;
b[half+1]=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[j]=((j+1)%half);
if (j==i) {
b[j]=half;
}
else {
b[j]=((j+1)%half);
}
}
else {
b[j]=((j+1)%half);
if (j==i) {
a[j]=half;
}
else {
a[j]=(j+1)%half;
}
}
}
a[half]=half;
b[half]=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 |
Partially correct |
65 ms |
344 KB |
Output is partially correct |
2 |
Partially correct |
64 ms |
344 KB |
Output is partially correct |
3 |
Incorrect |
59 ms |
344 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |