Submission #1029679

# Submission time Handle Problem Language Result Execution time Memory
1029679 2024-07-21T08:07:56 Z Otalp Super Dango Maker (JOI22_dango3) C++17
100 / 100
5255 ms 1752 KB
#include "dango3.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back


namespace {

int variable_example = 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int gen(int i){return rng()%i;}
}  // namespace


void Solve(int N, int M) {
    int n = N, m = M;
    map<int, int> us, ddus;
    vector<int> rs;
    for(int i=1; i<=n*m; i++){
        rs.pb(i);
    }
    random_shuffle(rs.begin(), rs.end(), gen);
    double D=0;
    for(int i=1; i<=m; i++){
        vector<int> d;
        for(int j: rs){
            if(us[j]) continue;
            d.pb(j);
            if(ddus[j]) continue;
            if(d.size() >= n){
                int g = Query(d);
                if(g) break;
            }
        }
        map<int, int> dus;
        int cnt = 0;
        D += d.size();
        //random_shuffle(d.begin(), d.end(), gen);
        int b=4;
        for(int i=0; i<d.size(); i+=b){
            vector<int> f;
            for(int j=i; j<i+b and j < d.size(); j++){
                dus[d[j]] = 1;
            }
            for(int y: d){
                if(dus[y]) continue;
                f.pb(y);
            }
            int g = Query(f);
            if(!g){
                for(int j=i; j<i+b and j < d.size(); j++){
                    dus[d[j]] = 0;
                }
                for(int j=i; j<i+b and j < d.size(); j++){
                    dus[d[j]] = 1;
                    f.clear();
                    for(int y: d){
                        if(dus[y]) continue;
                        f.pb(y);
                    }
                    int g = Query(f);
                    if(!g){
                        us[d[j]] = 1;
                        dus[d[j]] = 0;
                        cnt++;
                        if(cnt == n) break;
                    }
                }
            }
        }
        vector<int> f;
        for(int x: d){
            if(us[x]) f.pb(x);
            else ddus[x] = 1;
        }
        //for(int x: f) cout<<x<<' ';
        //cout<<'\n';
        Answer(f);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:25: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |             if(d.size() >= n){
      |                ~~~~~~~~~^~~~
dango3.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i=0; i<d.size(); i+=b){
      |                      ~^~~~~~~~~
dango3.cpp:42:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             for(int j=i; j<i+b and j < d.size(); j++){
      |                                    ~~^~~~~~~~~~
dango3.cpp:51:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |                 for(int j=i; j<i+b and j < d.size(); j++){
      |                                        ~~^~~~~~~~~~
dango3.cpp:54:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |                 for(int j=i; j<i+b and j < d.size(); j++){
      |                                        ~~^~~~~~~~~~
dango3.cpp: At global scope:
dango3.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 604 KB Output is correct
2 Correct 18 ms 600 KB Output is correct
3 Correct 19 ms 604 KB Output is correct
4 Correct 16 ms 620 KB Output is correct
5 Correct 16 ms 604 KB Output is correct
6 Correct 16 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 609 ms 848 KB Output is correct
2 Correct 343 ms 792 KB Output is correct
3 Correct 507 ms 816 KB Output is correct
4 Correct 350 ms 848 KB Output is correct
5 Correct 508 ms 1044 KB Output is correct
6 Correct 438 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4819 ms 1428 KB Output is correct
2 Correct 4895 ms 1624 KB Output is correct
3 Correct 4097 ms 1752 KB Output is correct
4 Correct 4786 ms 1428 KB Output is correct
5 Correct 5255 ms 1496 KB Output is correct
6 Correct 5114 ms 1652 KB Output is correct