# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1045648 |
2024-08-06T06:44:34 Z |
15분 56초! 15분 57초!(#11072) |
Ancient Machine 2 (JOI23_ancient2) |
C++17 |
|
0 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');
for(int i=0;i<500;i++) {
vector<int> a(502);
vector<int> b(502);
for(int j=0;j<500;j++) {
if (j==499) {
a.push_back(501);
}
else {
a.push_back(j+1);
}
if (j==i) {
b.push_back(500);
}
else {
b.push_back(j+1);
}
}
a.push_back(500);
b.push_back(500);
a.push_back(501);
b.push_back(501);
if (Query(502,a,b)==500) {
ret[i]=1;
}
else {
ret[i]=0;
}
}
for(int i=0;i<500;i++) {
vector<int> a(502);
vector<int> b(502);
for(int j=0;j<500;j++) {
if (ret[i]==0) {
a.push_back((j+1)%500);
if (j==i) {
b.push_back(500);
}
else {
b.push_back((j+1)%500);
}
}
else {
b.push_back((j+1)%500);
if (j==i) {
a.push_back(500);
}
else {
a.push_back((j+1)%500);
}
}
}
a.push_back(500);
b.push_back(500);
if (Query(501,a,b)==500) {
ret[i+500]=1-ret[i];
}
else {
ret[i+500]=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 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |