Submission #925971

# Submission time Handle Problem Language Result Execution time Memory
925971 2024-02-12T12:09:36 Z andrei_boaca Super Dango Maker (JOI22_dango3) C++17
22 / 100
2043 ms 864 KB
#include <bits/stdc++.h>
#include "dango3.h"
//#include "grader.cpp"
using namespace std;

int cul[10005];
int nn,mm;
vector<int> poz;
bool bad[10005];
bool have(int x,int l,int r)
{
    bad[x]=1;
    for(int i=l;i<=r;i++)
        bad[poz[i]]=1;
    vector<int> v;
    for(int i=1;i<=nn*mm;i++)
    {
        if(!bad[i])
            v.push_back(i);
        else
            bad[i]=0;
    }
    int rez=Query(v);
    return rez==mm-2;
}
bool f[10005];
void Solve(int n,int m)
{
    nn=n;
    mm=m;
    cul[1]=1;
    poz.push_back(1);
    for(int i=2;i<=n*m;i++)
    {
        int st=0;
        int dr=poz.size();
        dr--;
        int who=0;
        while(st<=dr)
        {
            int mij=(st+dr)/2;
            if(st==dr&&poz.size()==n)
            {
                who=st+1;
                break;
            }
            if(have(i,st,mij))
            {
                if(st==mij)
                {
                    who=st+1;
                    break;
                }
                dr=mij;
            }
            else
                st=mij+1;
        }
        if(who==0)
        {
            poz.push_back(i);
            who=poz.size();
        }
        cul[i]=who;
    }
    for(int z=1;z<=m;z++)
    {
        for(int i=1;i<=n;i++)
            f[i]=0;
        vector<int> v;
        for(int i=1;i<=n*m;i++)
            if(cul[i]!=0&&f[cul[i]]==0)
            {
                v.push_back(i);
                f[cul[i]]=1;
                cul[i]=0;
            }
        Answer(v);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:42:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |             if(st==dr&&poz.size()==n)
      |                        ~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 348 KB Output is correct
2 Correct 30 ms 344 KB Output is correct
3 Correct 26 ms 344 KB Output is correct
4 Correct 26 ms 344 KB Output is correct
5 Correct 28 ms 348 KB Output is correct
6 Correct 29 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 803 ms 560 KB Output is correct
2 Correct 831 ms 556 KB Output is correct
3 Correct 796 ms 588 KB Output is correct
4 Correct 796 ms 568 KB Output is correct
5 Correct 785 ms 596 KB Output is correct
6 Correct 788 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2043 ms 864 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -