Submission #617040

# Submission time Handle Problem Language Result Execution time Memory
617040 2022-08-01T08:21:36 Z 박상훈(#8502) Chameleon's Love (JOI20_chameleon) C++17
4 / 100
12 ms 320 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

namespace {

int n;
vector<int> cur;

}  // namespace

bool myquery(int l, int r){
    vector<int> tmp;
    for (int i=l;i<r;i++) tmp.push_back(cur[i]);
    return Query(tmp)!=r-l;
}

void Solve(int N) {
    n = N;

    for (int i=1;i<=n*2;i++){
        cur.push_back(i);
        if (Query(cur)!=(int)cur.size()){
            int l = 1, r = (int)cur.size()-2, idx = 0;
            while(l<=r){
                int m = (l+r)>>1;
                if (myquery(m, (int)cur.size())) idx = m, l = m+1;
                else r = m-1;
            }

            Answer(cur[idx], cur.back());
            cur.pop_back();
            cur.erase(cur.begin()+idx);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 10 ms 208 KB Output is correct
5 Correct 12 ms 208 KB Output is correct
6 Correct 11 ms 312 KB Output is correct
7 Correct 11 ms 312 KB Output is correct
8 Correct 11 ms 316 KB Output is correct
9 Correct 10 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 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 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 Correct 0 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 10 ms 208 KB Output is correct
5 Correct 12 ms 208 KB Output is correct
6 Correct 11 ms 312 KB Output is correct
7 Correct 11 ms 312 KB Output is correct
8 Correct 11 ms 316 KB Output is correct
9 Correct 10 ms 320 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -