답안 #988576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988576 2024-05-25T07:52:23 Z toan2602 Super Dango Maker (JOI22_dango3) C++17
22 / 100
317 ms 600 KB
#include<bits/stdc++.h>
#include "dango3.h"

using namespace std;

vector<int> ans, v2, x;
bool mark[100005];

void Solve(int n, int m) {

    for (int Q = 1; Q <= m; Q++) {
        x.clear();
        for (int i = n * m; i >= 1; i--) if(!mark[i]) x.push_back(i);
        ans.clear();
        v2 = x;
        while(!x.empty()) {
            int l = 0, r = x.size() - 1, mid, mx = 0;
            while(l <= r) {
                v2.clear();
                mid = (l + r) / 2;
                for (int i = 0; i < x.size() - mid; i++) {
                    v2.push_back(x[i]);
                }
                for (int i: ans) v2.push_back(i);
                if(Query(v2) == 0) r = mid - 1;
                else {
                    l = mid + 1;
                    mx = max(mx, mid);
                }
            }
            for (int i = 1; i <= mx; i++) {
                x.pop_back();
            }
            mark[x.back()] = true;
            ans.push_back(x.back());
            x.pop_back();
            if(ans.size() == n) break;
        }
        Answer(ans);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:21:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |                 for (int i = 0; i < x.size() - mid; i++) {
      |                                 ~~^~~~~~~~~~~~~~~~
dango3.cpp:37:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |             if(ans.size() == n) break;
      |                ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 348 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Correct 12 ms 348 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 69 ms 348 KB Output is correct
2 Correct 69 ms 596 KB Output is correct
3 Correct 317 ms 348 KB Output is correct
4 Correct 317 ms 568 KB Output is correct
5 Correct 34 ms 592 KB Output is correct
6 Correct 34 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 600 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -