Submission #1089588

# Submission time Handle Problem Language Result Execution time Memory
1089588 2024-09-16T18:29:27 Z _8_8_ Super Dango Maker (JOI22_dango3) C++17
22 / 100
636 ms 916 KB
#include "dango3.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;

int n, m;
const int N = 401;
bool bad[N * 26];
vector<int> get(vector<int> &a, vector<int> &b) {
    for(int j:a) {
        bad[j] = 0;
    }
    int lst = 0;
    vector<int> ret;
    for(int i = 0; i < m; i++) {
        int l = lst - 1, r = (int)a.size() - 1;
        int left = m - i;
        // cout << left << ' ' << lst << ' ' << (int)a.size() - lst + 1 << '\n';
        if(left == (int)a.size() - lst) {
            for(int j = lst; j < (int)a.size(); j++) {
                ret.push_back(a[j]);
            }
            break;
        }
        while(r - l > 1) {
            int mid = (l + r) >> 1;
            vector<int> t = b;
            for(int j = 0; j <= mid; j++) {
                if(!bad[a[j]])t.push_back(a[j]);
            }
            if(Query(t)) {
                r = mid;
            } else {
                l = mid; 
            }
        }
        lst = r + 1;
        // cout << a[r] << ' ' << lst << '\n';
        ret.push_back(a[r]);
        bad[a[r]] = 1;
    }
    return ret;
}
vector<int> res[N];
int timer = 0, vis[N * 26];
void Solve(int _n, int _m) {
    n = _n, m = _m;
    vector<int> f, bf;
    for(int i = 1; i <= n * m; i++) {
        f.push_back(i);
    }
    for(int i = 0; i < n; i++) {
        timer++;
        vector<int> nv = get(f, bf);
        bf.push_back(nv[0]);
        for(int j = 0; j < m; j++) {
            // cout << nv[j] << ' ';
            res[j].push_back(nv[j]);
            vis[nv[j]] = timer;
        }
        // cout << '\n';
        vector<int> sw;
        for(int j:f) {
            if(vis[j] != timer) {
                sw.push_back(j);
            }
        }
        f = sw;
    }
    for(int i = 0; i < m; i++) {
        Answer(res[i]);
    }
}
# 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 348 KB Output is correct
2 Correct 9 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 10 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 215 ms 604 KB Output is correct
2 Correct 223 ms 676 KB Output is correct
3 Correct 241 ms 600 KB Output is correct
4 Correct 252 ms 916 KB Output is correct
5 Correct 223 ms 600 KB Output is correct
6 Correct 240 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 636 ms 800 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -