Submission #635952

# Submission time Handle Problem Language Result Execution time Memory
635952 2022-08-27T12:46:02 Z Cross_Ratio Super Dango Maker (JOI22_dango3) C++17
22 / 100
2733 ms 704 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
int Query(const vector<int>&);
void Answer(const vector<int>&);
vector<vector<int>> A;
vector<int> V;
void Solve(int N, int M) {
    A.resize(N);
    int i, j;
    for(i=1;i<=N*M;i++) V.push_back(i);
    random_shuffle(V.begin(),V.end());
    vector<int> C;
    int base = 0;
    vector<int> prev(M);
    for(i=0;i<N;i++) {
        int prv = N-i-1;
        vector<int> B(M);
        vector<bool> on(V.size());
        for(j=0;j<V.size();j++) on[j] = true;
        for(j=0;j<M;j++) B[j] = V.size() - (M-j-1);
        if(i) {
            B[0] = min(B[0], prev[0]);
        }
        for(j=0;j<M;j++) {
            int s = prv;
            int e = B[j];
            while(s+1<e) {
                int mid = (s+e)/2;
                for(int k2=0;k2<mid;k2++) {
                    if(on[k2]) C.push_back(V[k2]);
                }
                int k = Query(C);
                for(int k2=0;k2<mid;k2++) {
                    if(on[k2]) C.pop_back();
                }
                if(k>1&&k-1+j<M) B[k-1+j] = min(B[k-1+j], mid);
                if(k==0) s = mid;
                else e = mid;
            }
            for(int k=M-2;k>=0;k--) B[k] = min(B[k], B[k+1]);
            A[i].push_back(V[s]);
            on[s] = false;
            prev[j] = s;
        }
        for(int n : A[i]) C.push_back(n);
        vector<int> V2;
        for(j=0;j<V.size();j++) {
            if(on[j]) V2.push_back(V[j]);
        }
        V = V2;
    }
    for(i=0;i<M;i++) {
        vector<int> F;
        for(j=0;j<N;j++) F.push_back(A[j][i]);
        Answer(F);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(j=0;j<V.size();j++) on[j] = true;
      |                 ~^~~~~~~~~
dango3.cpp:48:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         for(j=0;j<V.size();j++) {
      |                 ~^~~~~~~~~
dango3.cpp:14:9: warning: unused variable 'base' [-Wunused-variable]
   14 |     int base = 0;
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 376 KB Output is correct
2 Correct 41 ms 360 KB Output is correct
3 Correct 45 ms 340 KB Output is correct
4 Correct 45 ms 340 KB Output is correct
5 Correct 32 ms 376 KB Output is correct
6 Correct 45 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1214 ms 472 KB Output is correct
2 Correct 1210 ms 704 KB Output is correct
3 Correct 1184 ms 496 KB Output is correct
4 Correct 1089 ms 496 KB Output is correct
5 Correct 1302 ms 496 KB Output is correct
6 Correct 1189 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2733 ms 596 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -