답안 #1085533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085533 2024-09-08T11:43:22 Z vako_p 카멜레온의 사랑 (JOI20_chameleon) C++14
4 / 100
12 ms 600 KB
#include <bits/stdc++.h>
#include "chameleon.h"
using namespace std;
#define ll int
#define pb push_back

ll n; 
vector<ll> v1,v2;
vector<pair<ll,ll>> ans;

void Solve(int N){
	n = N;
	v1.pb(1);
	for(int i = 2; i <= 2 * n; i++){
		v1.pb(i);
		if(Query(v1) != v1.size()){
			ll l = 0, r = v1.size() - 1;
			while(r > l + 1){
				v2.clear();
				ll mid = l + (r - l) / 2;
				for(int j = mid; j < v1.size(); j++) v2.pb(v1[j]);
				if(Query(v2) != v2.size()) l = mid;
				else r = mid;
			}
			ans.pb({i, v1[l]});
			v1.pop_back();
			v1.erase(v1.begin() + l);
		}
	}	
//	cout << ans.size() << endl;
// 	for(auto it : ans) cout << it.first << ' ' << it.second << '\n';
 	for(auto it : ans) Answer(it.first, it.second);
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:16:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   if(Query(v1) != v1.size()){
      |      ~~~~~~~~~~^~~~~~~~~~~~
chameleon.cpp:21:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int j = mid; j < v1.size(); j++) v2.pb(v1[j]);
      |                      ~~^~~~~~~~~~~
chameleon.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     if(Query(v2) != v2.size()) l = mid;
      |        ~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 340 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 7 ms 600 KB Output is correct
8 Correct 7 ms 456 KB Output is correct
9 Correct 12 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 340 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 7 ms 600 KB Output is correct
8 Correct 7 ms 456 KB Output is correct
9 Correct 12 ms 464 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -