Submission #635946

# Submission time Handle Problem Language Result Execution time Memory
635946 2022-08-27T12:39:20 Z Cross_Ratio Super Dango Maker (JOI22_dango3) C++17
0 / 100
1430 ms 568 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;
    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);
        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(j=M-2;j>=0;j--) B[j] = min(B[j], B[j+1]);
            A[i].push_back(V[s]);
            on[s] = false;
        }
        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:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(j=0;j<V.size();j++) on[j] = true;
      |                 ~^~~~~~~~~
dango3.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         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 Incorrect 6 ms 468 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 224 ms 340 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 653 ms 568 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1430 ms 508 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -