Submission #945013

# Submission time Handle Problem Language Result Execution time Memory
945013 2024-03-13T09:54:20 Z siewjh Chameleon's Love (JOI20_chameleon) C++17
4 / 100
7 ms 596 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
}  // namespace

void Solve(int N) {
	set<int> unp;
	unp.insert(1);
	for (int i = 2; i <= 2 * N; i++){
		vector<int> vec;
		for (int x : unp) vec.push_back(x);
		vec.push_back(i);
		int amt = Query(vec);
		vec.pop_back();
		if (amt == unp.size()){
			int sz = vec.size(), l = 0, r = sz - 1;
			while (l < r){
				int m = (l + r) >> 1;
				vector<int> qvec;
				for (int j = l; j <= m; j++) qvec.push_back(vec[j]);
				qvec.push_back(i);
				if (Query(qvec) == qvec.size()) l = m + 1;
				else r = m;
			}
			Answer(i, vec[r]);
			unp.erase(vec[r]);
		}
		else unp.insert(i);
	}
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:17:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   if (amt == unp.size()){
      |       ~~~~^~~~~~~~~~~~~
chameleon.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if (Query(qvec) == qvec.size()) l = m + 1;
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 456 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 456 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 596 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -