답안 #635961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635961 2022-08-27T13:21:05 Z Cross_Ratio Super Dango Maker (JOI22_dango3) C++17
100 / 100
844 ms 712 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
int Query(const vector<int>&);
void Answer(const vector<int>&);
void solve(int N, vector<int> V) {
    if(V.size()==0) return;
    if(V.size()==N) {
        Answer(V);
        return;
    }
    int M = V.size() / N;
    int mid = (M / 2);
    int i, j;
    vector<int> V1, V2;
    while(V.size()) {
        int k = V.back();
        V.pop_back();
        for(int n : V1) V.push_back(n);
        int k2 = Query(V);
        for(int n : V1) V.pop_back();
        if(k2 < mid) {
            V1.push_back(k);
        }
        else V2.push_back(k);
    }
    solve(N, V1);
    solve(N, V2);
}
void Solve(int N, int M) {
    int i, j;
    vector<int> V;
    for(i=1;i<=N*M;i++) V.push_back(i);
    //random_shuffle(V.begin(),V.end());
    solve(N, V);
}

Compilation message

dango3.cpp: In function 'void solve(int, std::vector<int>)':
dango3.cpp:8:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |     if(V.size()==N) {
      |        ~~~~~~~~^~~
dango3.cpp:21:17: warning: unused variable 'n' [-Wunused-variable]
   21 |         for(int n : V1) V.pop_back();
      |                 ^
dango3.cpp:14:9: warning: unused variable 'i' [-Wunused-variable]
   14 |     int i, j;
      |         ^
dango3.cpp:14:12: warning: unused variable 'j' [-Wunused-variable]
   14 |     int i, j;
      |            ^
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:31:12: warning: unused variable 'j' [-Wunused-variable]
   31 |     int i, j;
      |            ^
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 9 ms 372 KB Output is correct
4 Correct 9 ms 368 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 7 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 588 KB Output is correct
2 Correct 159 ms 460 KB Output is correct
3 Correct 216 ms 424 KB Output is correct
4 Correct 208 ms 444 KB Output is correct
5 Correct 176 ms 416 KB Output is correct
6 Correct 169 ms 480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 686 ms 604 KB Output is correct
2 Correct 716 ms 712 KB Output is correct
3 Correct 844 ms 696 KB Output is correct
4 Correct 834 ms 636 KB Output is correct
5 Correct 631 ms 596 KB Output is correct
6 Correct 607 ms 528 KB Output is correct