답안 #423820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
423820 2021-06-11T13:03:35 Z kai824 카멜레온의 사랑 (JOI20_chameleon) C++17
4 / 100
10 ms 304 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

namespace{
  vector<int> v;
}
void search(){
  int x=v.back();v.pop_back();

  vector<int> tmp;
  int lo=0,hi=v.size()-1,mid;
  while(lo<hi){
    mid=lo+((hi-lo)/2);
    tmp.clear();
    tmp.push_back(x);
    for(int i=lo;i<=mid;i++)tmp.push_back(v[i]);
    if(Query(tmp)<tmp.size())hi=mid;
    else lo=mid+1;
  }
  //cout<<v[lo]<<' '<<x<<'\n';
  Answer(v[lo],x);
  v.erase(v.begin()+lo);
}

void Solve(int n) {
  v.push_back(1);
  for(int i=2;i<=2*n;i++){
    v.push_back(i);
    if(v.size()==1)continue;
    if(Query(v)<v.size()){//lermao...
      search();
    }
  }

  //Answer(i * 2 + 1, i * 2 + 2);
}

Compilation message

chameleon.cpp: In function 'void search()':
chameleon.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     if(Query(tmp)<tmp.size())hi=mid;
      |        ~~~~~~~~~~^~~~~~~~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(Query(v)<v.size()){//lermao...
      |        ~~~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 9 ms 200 KB Output is correct
4 Correct 8 ms 200 KB Output is correct
5 Correct 8 ms 304 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
8 Correct 10 ms 200 KB Output is correct
9 Correct 8 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 9 ms 200 KB Output is correct
4 Correct 8 ms 200 KB Output is correct
5 Correct 8 ms 304 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
8 Correct 10 ms 200 KB Output is correct
9 Correct 8 ms 200 KB Output is correct
10 Correct 0 ms 200 KB Output is correct
11 Incorrect 0 ms 200 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -