Submission #956027

# Submission time Handle Problem Language Result Execution time Memory
956027 2024-03-31T19:55:54 Z MarwenElarbi Super Dango Maker (JOI22_dango3) C++17
100 / 100
6298 ms 1544 KB
#include <bits/stdc++.h>
#include "dango3.h"

#include <vector>
using namespace std;
namespace {

int variable_example = 1;

} 
set<int> colors[25];
void Solve(int N, int M){
    int n=N;
    int m=M;
    //cout <<n<<" "<<m<<endl;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            int l=-1;
            int r=m-1;
            while(r-l>1){
                int mid=(r+l)/2;
                vector<int> cur;
                for (int k = 1; k <= n*m; ++k)
                {
                    if(k==i*m+j+1) continue;
                    if(colors[mid].count(k)) continue;
                    cur.push_back(k); 
                }
                int res=Query(cur);
                if(m-res>1) l=mid;
                else r=mid;
            }
            //for(auto u:colors[0]) cout <<u<<" ";
            //cout <<endl;
            vector<int> cur;
            for (int k = 1; k <= n*m; ++k)
            {
                if(k==i*m+j+1) continue;
                if(colors[r].count(k)) continue;
                cur.push_back(k); 
            }
            //cout <<r<<" "<<Query(cur)<<" "<<i*m+j+1<<" "<<i<<" "<<j<<endl;
            colors[r].insert(i*m+j+1);
        }
    }
    vector<int> ans[m];
    for (int i = 0; i < m; ++i)
    {
        //cout <<colors[i].size()<<endl;
        for(auto u:colors[i]) ans[i].push_back(u); 
    }
    for (int i = 0; i < m; ++i)
    {
        Answer(ans[i]);
    }
}

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 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 1 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 38 ms 532 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 40 ms 344 KB Output is correct
4 Correct 41 ms 520 KB Output is correct
5 Correct 34 ms 348 KB Output is correct
6 Correct 34 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1259 ms 1108 KB Output is correct
2 Correct 1259 ms 868 KB Output is correct
3 Correct 1350 ms 724 KB Output is correct
4 Correct 1355 ms 832 KB Output is correct
5 Correct 1138 ms 900 KB Output is correct
6 Correct 1136 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6122 ms 1324 KB Output is correct
2 Correct 6179 ms 1108 KB Output is correct
3 Correct 6298 ms 1384 KB Output is correct
4 Correct 6249 ms 1060 KB Output is correct
5 Correct 5116 ms 1544 KB Output is correct
6 Correct 5118 ms 1440 KB Output is correct