Submission #1000569

# Submission time Handle Problem Language Result Execution time Memory
1000569 2024-06-17T19:41:34 Z De3b0o Super Dango Maker (JOI22_dango3) C++17
100 / 100
2641 ms 1128 KB
#include "dango3.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*x)
#define rc (2*x+1)

using namespace std;

ll n , m;
vector<int> ans[26];
bool vis[26][10001];
vector<ll> idx;

void Solve(int N, int M)
{
    n=N;
    m=M;
    for(int i = 1 ; n*m>=i ; i++)
        idx.pb(i);
    random_shuffle(idx.begin(),idx.end());
    for(int h = 0 ; n*m>h ; h++)
    {
        ll i = idx[h];
        ll l = 0 , r = m-1;
        ll f;
        while(l<=r)
        {
            ll j = mid;
            if(ans[j].size()==n)
            {
                l=mid+1;
                continue;
            }
            vector<int> q;
            for(int jj = 1 ; n*m>=jj ; jj++)
            {
                if(vis[j][jj]||jj==i)
                    continue;
                q.pb(jj);
            }
            if(Query(q)==m-1)
            {
                f=j;
                r=j-1;
            }
            else
                l=j+1;
        }
        vis[f][i]=1;
        ans[f].pb(i);
    }
    for(int i = 0 ; m>i ; i++)
        Answer(ans[i]);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:43:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   43 |             if(ans[j].size()==n)
      |                ~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 344 KB Output is correct
2 Correct 12 ms 348 KB Output is correct
3 Correct 12 ms 344 KB Output is correct
4 Correct 12 ms 556 KB Output is correct
5 Correct 12 ms 348 KB Output is correct
6 Correct 12 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 509 ms 684 KB Output is correct
2 Correct 446 ms 852 KB Output is correct
3 Correct 477 ms 604 KB Output is correct
4 Correct 492 ms 668 KB Output is correct
5 Correct 448 ms 604 KB Output is correct
6 Correct 461 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2424 ms 808 KB Output is correct
2 Correct 2457 ms 996 KB Output is correct
3 Correct 2641 ms 848 KB Output is correct
4 Correct 2588 ms 1036 KB Output is correct
5 Correct 2413 ms 1128 KB Output is correct
6 Correct 2503 ms 1104 KB Output is correct