Submission #635948

# Submission time Handle Problem Language Result Execution time Memory
635948 2022-08-27T12:41:19 Z Cross_Ratio Super Dango Maker (JOI22_dango3) C++17
7 / 100
2814 ms 596 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(int k=M-2;k>=0;k--) B[k] = min(B[k], B[k+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 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 41 ms 364 KB Output is correct
2 Correct 42 ms 372 KB Output is correct
3 Correct 43 ms 312 KB Output is correct
4 Correct 42 ms 376 KB Output is correct
5 Correct 43 ms 340 KB Output is correct
6 Correct 44 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1208 ms 472 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2814 ms 596 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -