Submission #616722

# Submission time Handle Problem Language Result Execution time Memory
616722 2022-08-01T06:25:20 Z 이동현(#8506) Chameleon's Love (JOI20_chameleon) C++17
4 / 100
14 ms 320 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

int variable_example = 1;

}  // namespace

void Solve(int n) {
    vector<int> stk;

    for(int i = 0; i < n * 2; ++i){
        stk.push_back(i + 1);

        int rv = Query(stk);

        if(rv == (int)stk.size()){
            continue;
        }

        stk.pop_back();

        int low = 0, high = (int)stk.size() - 1, mid;
        while(low < high){
            mid = low + high >> 1;

            vector<int> ask;
            for(int i = 0; i <= mid; ++i){
                ask.push_back(stk[i]);
            }
            ask.push_back(i + 1);

            if(Query(ask) == (int)ask.size()){
                low = mid + 1;
            }
            else{
                high = mid;
            }
        }

        Answer(i + 1, stk[low]);

        for(int i = low; i < (int)stk.size() - 1; ++i){
            stk[i] = stk[i + 1];
        }
        stk.pop_back();
    }
}
// #include "chameleon.h"
// #include <vector>

// namespace {

// int variable_example = 1;

// }  // namespace

// void Solve(int N) {
//   std::vector<int> p(3);
//   p[0] = 1;
//   p[1] = 2;
//   p[2] = 3;
//   variable_example = Query(p);
//   for (int i = 0; i < N; ++i) {
//     Answer(i * 2 + 1, i * 2 + 2);
//   }
// }

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:28:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   28 |             mid = low + high >> 1;
      |                   ~~~~^~~~~~
chameleon.cpp: At global scope:
chameleon.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 10 ms 320 KB Output is correct
4 Correct 14 ms 208 KB Output is correct
5 Correct 9 ms 292 KB Output is correct
6 Correct 10 ms 316 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 10 ms 208 KB Output is correct
9 Correct 10 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 10 ms 320 KB Output is correct
4 Correct 14 ms 208 KB Output is correct
5 Correct 9 ms 292 KB Output is correct
6 Correct 10 ms 316 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 10 ms 208 KB Output is correct
9 Correct 10 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 0 ms 208 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -