# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596846 |
2022-07-15T07:30:45 Z |
조영욱(#8449) |
Super Dango Maker (JOI22_dango3) |
C++17 |
|
3984 ms |
736 KB |
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 1;
bool chk[100001];
int ret[100001];
bool used[401];
} // namespace
void Solve(int n,int m) {
for(int i=1;i<=n;i++) {
int cnt=1;
int st=0;
for(int j=1;j<=n*m;j++) {
if (!chk[j]) {
chk[j]=true;
st=j;
ret[j]=i;
break;
}
}
int ind=st+1;
while (ind<=n*m) {
if (cnt==m) {
break;
}
vector<int> vec;
int le=ind;
int ri=ind-1;
int val=0;
vector<int> v;
while (ri+1<=n*m&&val<cnt) {
if (!chk[ri+1]) {
val++;
v.push_back(ri+1);
}
ri++;
}
for(int j=1;j<=n*m;j++) {
if (j<le||j>ri) {
if (ret[j]!=i)
vec.push_back(j);
}
else if (chk[j]) {
vec.push_back(j);
}
}
int got=Query(vec);
//printf("%d %d %d %d %d\n",i,ind,got,le,ri);
if (got<m-cnt) {
int found=m-cnt-got;
for(int j=0;j<v.size();j++) {
if (found==0) {
break;
}
int now=v[j];
if (j+1==v.size()) {
assert(found==1);
cnt++;
found--;
chk[now]=true;
ret[now]=i;
break;
}
vector<int> vec;
for(int k=1;k<=n*m;k++) {
if(k!=st&&k!=now) {
vec.push_back(k);
}
}
//printf("%d %d %d\n",i,le,ri);
if (Query(vec)<m-1) {
cnt++;
found--;
chk[now]=true;
ret[now]=i;
}
}
}
ind=ri+1;
}
}
memset(chk,0,sizeof(chk));
for(int i=1;i<=m;i++) {
memset(used,0,sizeof(used));
vector<int> vec;
for(int j=1;j<=n*m;j++) {
//printf("%d ",ret[j]);
if (!chk[j]&&!used[ret[j]]) {
used[ret[j]]=true;
chk[j]=true;
vec.push_back(j);
}
}
//printf("\n");
Answer(vec);
}
}
Compilation message
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:56:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(int j=0;j<v.size();j++) {
| ~^~~~~~~~~
dango3.cpp:61:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | if (j+1==v.size()) {
| ~~~^~~~~~~~~~
dango3.cpp: At global scope:
dango3.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
8 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
368 KB |
Output is correct |
2 |
Correct |
143 ms |
380 KB |
Output is correct |
3 |
Correct |
19 ms |
440 KB |
Output is correct |
4 |
Correct |
27 ms |
388 KB |
Output is correct |
5 |
Correct |
151 ms |
368 KB |
Output is correct |
6 |
Correct |
131 ms |
368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2095 ms |
492 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3984 ms |
736 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |