답안 #1050210

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050210 2024-08-09T08:00:21 Z 변재우(#11050) 카멜레온의 사랑 (JOI20_chameleon) C++17
4 / 100
10 ms 464 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> V;

void Erase(int p) {
  for(int i=p; i<V.size()-1; i++) swap(V[i], V[i+1]);
  V.pop_back();
}

void Solve(int N) {
  for(int i=1; i<=2*N; i++) V.push_back(i);
  for(int i=1; i<=N; i++) {
    int x=V[0]; Erase(0);
    int p=0;
    for(int s=0, e=V.size()-1; s<e; ) {
      int m=(s+e)/2;
      vector<int> tmp;
      for(int j=s; j<=m; j++) tmp.push_back(V[j]);
      int q1=Query(tmp);
      tmp.push_back(x);
      int q2=Query(tmp);
      if(q2>q1) s=m+1, p=s;
      else e=m;
    }
    Answer(x, V[p]);
    Erase(p);
  }
}

Compilation message

chameleon.cpp: In function 'void Erase(int)':
chameleon.cpp:8:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |   for(int i=p; i<V.size()-1; i++) swap(V[i], V[i+1]);
      |                ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 452 KB Output is correct
4 Correct 8 ms 464 KB Output is correct
5 Correct 10 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 8 ms 456 KB Output is correct
8 Correct 8 ms 464 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong Answer [6]
4 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 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 452 KB Output is correct
4 Correct 8 ms 464 KB Output is correct
5 Correct 10 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 8 ms 456 KB Output is correct
8 Correct 8 ms 464 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Incorrect 0 ms 344 KB Wrong Answer [6]
13 Halted 0 ms 0 KB -