Submission #596826

# Submission time Handle Problem Language Result Execution time Memory
596826 2022-07-15T07:11:06 Z 조영욱(#8449) Super Dango Maker (JOI22_dango3) C++17
2 / 100
3940 ms 672 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;
            while (ri+1<=n*m&&val<cnt) {
                if (!chk[ri+1]) {
                    val++;
                }
                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=le;j<=ri;j++) {
                    if (found==0) {
                        break;
                    }
                    vector<int> vec;
                    for(int k=1;k<=n*m;k++) {
                        if(k!=st&&k!=j) {
                            vec.push_back(k);
                        }
                    }
                    if (Query(vec)<m-1) {
                        cnt++;
                        found--;
                        chk[j]=true;
                        ret[j]=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: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 468 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 0 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 190 ms 436 KB Output is correct
2 Correct 196 ms 432 KB Output is correct
3 Correct 22 ms 384 KB Output is correct
4 Correct 28 ms 376 KB Output is correct
5 Incorrect 413 ms 368 KB Wrong Answer [3]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2007 ms 496 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3940 ms 672 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -