Submission #905219

# Submission time Handle Problem Language Result Execution time Memory
905219 2024-01-12T18:28:43 Z Ahmed57 Super Dango Maker (JOI22_dango3) C++17
100 / 100
2000 ms 1200 KB
#include "dango3.h"
 
#include <bits/stdc++.h>
using namespace std;
/*
min freq
max freq
*/

void Solve(int n,int m){
    vector<int> v[m];
    int cnt = 0;
    int taked[n*m+1] = {0};
    for(int i = 1;i<=n*m;i++){
        int l = 0 , r = m-1 , ans = 0;
        while(l<=r){
            int mid = (l+r)/2;
            vector<int> d;
            cnt++;
            taked[i] = cnt;
            for(int j = 0;j<=mid;j++){
                for(auto e:v[j]){
                    taked[e] = cnt;
                }
            }
            vector<int> qu;
            for(int j = 1;j<=n*m;j++){
                if(taked[j]!=cnt){
                    qu.push_back(j);
                }
            }
            if(m-Query(qu)<=mid+1){
                ans = mid;
                r = mid-1;
            }else l = mid+1;
        }
        v[ans].push_back(i);
    }
    for(int i =0;i<m;i++){
        Answer(v[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 348 KB Output is correct
2 Correct 15 ms 348 KB Output is correct
3 Correct 15 ms 512 KB Output is correct
4 Correct 16 ms 344 KB Output is correct
5 Correct 15 ms 344 KB Output is correct
6 Correct 14 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 454 ms 348 KB Output is correct
2 Correct 441 ms 596 KB Output is correct
3 Correct 510 ms 612 KB Output is correct
4 Correct 505 ms 596 KB Output is correct
5 Correct 432 ms 572 KB Output is correct
6 Correct 429 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1761 ms 944 KB Output is correct
2 Correct 1782 ms 952 KB Output is correct
3 Correct 2000 ms 1200 KB Output is correct
4 Correct 1992 ms 900 KB Output is correct
5 Correct 1707 ms 672 KB Output is correct
6 Correct 1703 ms 676 KB Output is correct