Submission #635941

# Submission time Handle Problem Language Result Execution time Memory
635941 2022-08-27T12:32:10 Z Cross_Ratio Super Dango Maker (JOI22_dango3) C++17
7 / 100
2462 ms 636 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);
    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;
            }
            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:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for(j=0;j<V.size();j++) on[j] = true;
      |                 ~^~~~~~~~~
dango3.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(j=0;j<V.size();j++) {
      |                 ~^~~~~~~~~
dango3.cpp:13:9: warning: unused variable 'base' [-Wunused-variable]
   13 |     int base = 0;
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 304 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 340 KB Output is correct
2 Correct 41 ms 340 KB Output is correct
3 Correct 57 ms 372 KB Output is correct
4 Correct 52 ms 372 KB Output is correct
5 Correct 40 ms 340 KB Output is correct
6 Correct 41 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1173 ms 496 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2462 ms 636 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -