# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596835 |
2022-07-15T07:23:06 Z |
조영욱(#8449) |
Super Dango Maker (JOI22_dango3) |
C++17 |
|
3912 ms |
668 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);
}
}
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()) {
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:53:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int j=0;j<v.size();j++) {
| ~^~~~~~~~~
dango3.cpp:58:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | 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 |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
201 ms |
376 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1998 ms |
468 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3912 ms |
668 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |