답안 #1033151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1033151 2024-07-24T13:25:29 Z adaawf Super Dango Maker (JOI22_dango3) C++17
22 / 100
1845 ms 920 KB
#include <iostream>
#include <vector>
#include "dango3.h"
using namespace std;
vector<int> trya(vector<int> v, int x) {
    vector<int> vv;
    for (int w : v) {
        if (w != x) {
            vv.push_back(w);
        }
    }
    return vv;
}
/*void Print(vector<int> v) {
    for (int w : v) cout << w << " ";
    cout << '\n';
}
int Query(vector<int> v) {
    Print(v);
    int k;
    cin >> k;
    return k;
}
void Answer(vector<int> v) {
    Print(v);
}
void Solve(int n, int m);
int main() {
    int n = 3, m = 3;
    Solve(n, m);
}*/
void Solve(int n, int m) {
    vector<int> v;
    vector<vector<int>> res;
    for (int i = 1; i <= n * m; i++) {
        v.push_back(i);
    }
    for (int i = 1; i <= m; i++) {
        vector<int> vv = v;
        int h = 0;
        while (vv.size() > n) {
            if (h < vv.size() - 1) {
                if (Query(trya(trya(vv, vv[h]), vv[h + 1])) != 0) {
                    vv = trya(trya(vv, vv[h]), vv[h + 1]);
                }
                else if (Query(trya(vv, vv[h])) != 0) {
                    vv = trya(vv, vv[h]);
                }
                else if (Query(trya(vv, vv[h + 1])) != 0) {
                    vv = trya(vv, vv[h + 1]);
                    h++;
                }
                else h += 2;
            }
            else if (Query(trya(vv, vv[h])) != 0) {
                vv = trya(vv, vv[h]);
            }
            else h++;
        }
        res.push_back(vv);
        for (int w : vv) v = trya(v, w);
    }
    for (auto w : res) Answer(w);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:41:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |         while (vv.size() > n) {
      |                ~~~~~~~~~~^~~
dango3.cpp:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             if (h < vv.size() - 1) {
      |                 ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 12 ms 548 KB Output is correct
3 Correct 22 ms 348 KB Output is correct
4 Correct 13 ms 348 KB Output is correct
5 Correct 9 ms 556 KB Output is correct
6 Correct 10 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 498 ms 700 KB Output is correct
2 Correct 481 ms 692 KB Output is correct
3 Correct 554 ms 728 KB Output is correct
4 Correct 607 ms 724 KB Output is correct
5 Correct 506 ms 700 KB Output is correct
6 Correct 490 ms 728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1845 ms 920 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -